org.outernet.cesium-unity 1.15.3-linux.1
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/CHANGES.md +420 -0
- package/CHANGES.md.meta +7 -0
- package/Editor/BuildCesiumForUnity.cs +186 -0
- package/Editor/BuildCesiumForUnity.cs.meta +11 -0
- package/Editor/Cesium3DTilesetEditor.cs +542 -0
- package/Editor/Cesium3DTilesetEditor.cs.meta +11 -0
- package/Editor/CesiumBingMapsRasterOverlayEditor.cs +66 -0
- package/Editor/CesiumBingMapsRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumCameraControllerEditor.cs +174 -0
- package/Editor/CesiumCameraControllerEditor.cs.meta +11 -0
- package/Editor/CesiumCameraManagerEditor.cs +65 -0
- package/Editor/CesiumCameraManagerEditor.cs.meta +11 -0
- package/Editor/CesiumCartographicPolygonEditor.cs +23 -0
- package/Editor/CesiumCartographicPolygonEditor.cs.meta +11 -0
- package/Editor/CesiumDebugColorizeTilesRasterOverlayEditor.cs +41 -0
- package/Editor/CesiumDebugColorizeTilesRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumEditor.asmdef +26 -0
- package/Editor/CesiumEditor.asmdef.meta +7 -0
- package/Editor/CesiumEditorStyle.cs +188 -0
- package/Editor/CesiumEditorStyle.cs.meta +11 -0
- package/Editor/CesiumEditorUtility.cs +394 -0
- package/Editor/CesiumEditorUtility.cs.meta +11 -0
- package/Editor/CesiumEditorWindow.cs +447 -0
- package/Editor/CesiumEditorWindow.cs.meta +11 -0
- package/Editor/CesiumFlyToControllerEditor.cs +76 -0
- package/Editor/CesiumFlyToControllerEditor.cs.meta +11 -0
- package/Editor/CesiumGeoreferenceEditor.cs +277 -0
- package/Editor/CesiumGeoreferenceEditor.cs.meta +11 -0
- package/Editor/CesiumGlobeAnchorEditor.cs +202 -0
- package/Editor/CesiumGlobeAnchorEditor.cs.meta +11 -0
- package/Editor/CesiumInspectorGUI.cs +187 -0
- package/Editor/CesiumInspectorGUI.cs.meta +11 -0
- package/Editor/CesiumIonAsset.cs +192 -0
- package/Editor/CesiumIonAsset.cs.meta +11 -0
- package/Editor/CesiumIonAssetsWindow.cs +257 -0
- package/Editor/CesiumIonAssetsWindow.cs.meta +11 -0
- package/Editor/CesiumIonRasterOverlayEditor.cs +87 -0
- package/Editor/CesiumIonRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumIonServerManager.cs +153 -0
- package/Editor/CesiumIonServerManager.cs.meta +11 -0
- package/Editor/CesiumIonServerSelector.cs +127 -0
- package/Editor/CesiumIonServerSelector.cs.meta +11 -0
- package/Editor/CesiumIonSession.cs +102 -0
- package/Editor/CesiumIonSession.cs.meta +11 -0
- package/Editor/CesiumPolygonRasterOverlayEditor.cs +102 -0
- package/Editor/CesiumPolygonRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumRasterOverlayEditor.cs +230 -0
- package/Editor/CesiumRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumSubSceneEditor.cs +201 -0
- package/Editor/CesiumSubSceneEditor.cs.meta +11 -0
- package/Editor/CesiumTileMapServiceRasterOverlayEditor.cs +88 -0
- package/Editor/CesiumTileMapServiceRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumWebMapServiceRasterOverlayEditor.cs +111 -0
- package/Editor/CesiumWebMapServiceRasterOverlayEditor.cs.meta +11 -0
- package/Editor/CesiumWebMapTileServiceRasterOverlayEditor.cs +277 -0
- package/Editor/CesiumWebMapTileServiceRasterOverlayEditor.cs.meta +3 -0
- package/Editor/CompileCesiumForUnityNative.cs +581 -0
- package/Editor/CompileCesiumForUnityNative.cs.meta +11 -0
- package/Editor/ConfigureReinterop.cs +255 -0
- package/Editor/ConfigureReinterop.cs.meta +11 -0
- package/Editor/Helpers.cs +102 -0
- package/Editor/Helpers.cs.meta +11 -0
- package/Editor/IonAssetsMultiColumnHeader.cs +45 -0
- package/Editor/IonAssetsMultiColumnHeader.cs.meta +11 -0
- package/Editor/IonAssetsTreeView.cs +214 -0
- package/Editor/IonAssetsTreeView.cs.meta +11 -0
- package/Editor/IonMissingAssetWindow.cs +65 -0
- package/Editor/IonMissingAssetWindow.cs.meta +11 -0
- package/Editor/IonTokenTroubleshootingWindow.cs +615 -0
- package/Editor/IonTokenTroubleshootingWindow.cs.meta +11 -0
- package/Editor/NativeDownloadHandler.cs +35 -0
- package/Editor/NativeDownloadHandler.cs.meta +11 -0
- package/Editor/QuickAddItem.cs +43 -0
- package/Editor/QuickAddItem.cs.meta +11 -0
- package/Editor/Resources/Cesium-128x128.png +0 -0
- package/Editor/Resources/Cesium-128x128.png.meta +98 -0
- package/Editor/Resources/Cesium-24x24.png +0 -0
- package/Editor/Resources/Cesium-24x24.png.meta +123 -0
- package/Editor/Resources/Cesium-64x64.png +0 -0
- package/Editor/Resources/Cesium-64x64.png.meta +98 -0
- package/Editor/Resources/Cesium-for-Unity-dark.png +0 -0
- package/Editor/Resources/Cesium-for-Unity-dark.png.meta +123 -0
- package/Editor/Resources/Cesium-for-Unity-light.png +0 -0
- package/Editor/Resources/Cesium-for-Unity-light.png.meta +123 -0
- package/Editor/Resources/Cesium-icon-16x16.png +0 -0
- package/Editor/Resources/Cesium-icon-16x16.png.meta +98 -0
- package/Editor/Resources/FontAwesome/attribution.txt +9 -0
- package/Editor/Resources/FontAwesome/attribution.txt.meta +7 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.png +0 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/book-reader-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/check-solid.png +0 -0
- package/Editor/Resources/FontAwesome/check-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/check-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/check-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.png +0 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/cloud-upload-alt-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/folder.png +0 -0
- package/Editor/Resources/FontAwesome/folder.png.meta +147 -0
- package/Editor/Resources/FontAwesome/folder.svg +5 -0
- package/Editor/Resources/FontAwesome/folder.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.png +0 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/hands-helping-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/key-solid.png +0 -0
- package/Editor/Resources/FontAwesome/key-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/key-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/key-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/plus-solid.png +0 -0
- package/Editor/Resources/FontAwesome/plus-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/plus-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/plus-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.png +0 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/sign-out-alt-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.png +0 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/sync-alt-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome/times-solid.png +0 -0
- package/Editor/Resources/FontAwesome/times-solid.png.meta +98 -0
- package/Editor/Resources/FontAwesome/times-solid.svg +1 -0
- package/Editor/Resources/FontAwesome/times-solid.svg.meta +7 -0
- package/Editor/Resources/FontAwesome.meta +8 -0
- package/Editor/Resources.meta +8 -0
- package/Editor/SelectIonTokenWindow.cs +249 -0
- package/Editor/SelectIonTokenWindow.cs.meta +11 -0
- package/Editor/arm64.meta +8 -0
- package/Editor/csc.rsp +1 -0
- package/Editor/csc.rsp.meta +7 -0
- package/Editor/libCesiumForUnityNative-Editor.so +0 -0
- package/Editor/libCesiumForUnityNative-Editor.so.meta +2 -0
- package/Editor/libCesiumForUnityNative-Runtime.so +0 -0
- package/Editor/libCesiumForUnityNative-Runtime.so.meta +2 -0
- package/Editor/x86_64.meta +8 -0
- package/Editor.meta +8 -0
- package/LICENSE +201 -0
- package/LICENSE.meta +7 -0
- package/Plugins/Standalone/libCesiumForUnityNative-Runtime.so +0 -0
- package/Plugins/Standalone/libCesiumForUnityNative-Runtime.so.meta +2 -0
- package/Plugins/Standalone.meta +8 -0
- package/Plugins.meta +8 -0
- package/README.md +39 -0
- package/README.md.meta +7 -0
- package/Reinterop.deps.json +172 -0
- package/Reinterop.deps.json.meta +7 -0
- package/Reinterop.dll +0 -0
- package/Reinterop.dll.meta +79 -0
- package/Runtime/Cesium3DTile.cs +37 -0
- package/Runtime/Cesium3DTile.cs.meta +11 -0
- package/Runtime/Cesium3DTileset.cs +788 -0
- package/Runtime/Cesium3DTileset.cs.meta +11 -0
- package/Runtime/Cesium3DTilesetLoadFailureDetails.cs +65 -0
- package/Runtime/Cesium3DTilesetLoadFailureDetails.cs.meta +11 -0
- package/Runtime/CesiumBackwardCompatibility.cs +163 -0
- package/Runtime/CesiumBackwardCompatibility.cs.meta +11 -0
- package/Runtime/CesiumBingMapsRasterOverlay.cs +72 -0
- package/Runtime/CesiumBingMapsRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumCameraController.cs +827 -0
- package/Runtime/CesiumCameraController.cs.meta +11 -0
- package/Runtime/CesiumCameraManager.cs +105 -0
- package/Runtime/CesiumCameraManager.cs.meta +11 -0
- package/Runtime/CesiumCartographicPolygon.cs +152 -0
- package/Runtime/CesiumCartographicPolygon.cs.meta +11 -0
- package/Runtime/CesiumCreditSystem.cs +343 -0
- package/Runtime/CesiumCreditSystem.cs.meta +11 -0
- package/Runtime/CesiumCreditSystemUI.cs +402 -0
- package/Runtime/CesiumCreditSystemUI.cs.meta +11 -0
- package/Runtime/CesiumDebugColorizeTilesRasterOverlay.cs +21 -0
- package/Runtime/CesiumDebugColorizeTilesRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumEllipsoid.cs +107 -0
- package/Runtime/CesiumEllipsoid.cs.meta +11 -0
- package/Runtime/CesiumFeature.cs +279 -0
- package/Runtime/CesiumFeature.cs.meta +11 -0
- package/Runtime/CesiumFeatureIdAttribute.cs +61 -0
- package/Runtime/CesiumFeatureIdAttribute.cs.meta +11 -0
- package/Runtime/CesiumFeatureIdSet.cs +165 -0
- package/Runtime/CesiumFeatureIdSet.cs.meta +11 -0
- package/Runtime/CesiumFeatureIdTexture.cs +68 -0
- package/Runtime/CesiumFeatureIdTexture.cs.meta +11 -0
- package/Runtime/CesiumFlyToController.cs +539 -0
- package/Runtime/CesiumFlyToController.cs.meta +11 -0
- package/Runtime/CesiumGeoreference.cs +628 -0
- package/Runtime/CesiumGeoreference.cs.meta +11 -0
- package/Runtime/CesiumGlobeAnchor.cs +664 -0
- package/Runtime/CesiumGlobeAnchor.cs.meta +11 -0
- package/Runtime/CesiumGlobeAnchorBackwardCompatibility0dot2dot0.cs +105 -0
- package/Runtime/CesiumGlobeAnchorBackwardCompatibility0dot2dot0.cs.meta +11 -0
- package/Runtime/CesiumIntMatN.cs +398 -0
- package/Runtime/CesiumIntMatN.cs.meta +11 -0
- package/Runtime/CesiumIntVecN.cs +525 -0
- package/Runtime/CesiumIntVecN.cs.meta +11 -0
- package/Runtime/CesiumIonRasterOverlay.cs +110 -0
- package/Runtime/CesiumIonRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumIonServer.cs +137 -0
- package/Runtime/CesiumIonServer.cs.meta +11 -0
- package/Runtime/CesiumMetadata.cs +33 -0
- package/Runtime/CesiumMetadata.cs.meta +11 -0
- package/Runtime/CesiumMetadataValue.cs +1764 -0
- package/Runtime/CesiumMetadataValue.cs.meta +11 -0
- package/Runtime/CesiumMetadataValueType.cs +203 -0
- package/Runtime/CesiumMetadataValueType.cs.meta +11 -0
- package/Runtime/CesiumModelMetadata.cs +26 -0
- package/Runtime/CesiumModelMetadata.cs.meta +11 -0
- package/Runtime/CesiumObjectPool.cs +74 -0
- package/Runtime/CesiumObjectPool.cs.meta +11 -0
- package/Runtime/CesiumObjectPools.cs +39 -0
- package/Runtime/CesiumObjectPools.cs.meta +11 -0
- package/Runtime/CesiumOriginShift.cs +146 -0
- package/Runtime/CesiumOriginShift.cs.meta +11 -0
- package/Runtime/CesiumPointCloudRenderer.cs +246 -0
- package/Runtime/CesiumPointCloudRenderer.cs.meta +11 -0
- package/Runtime/CesiumPointCloudShading.cs +76 -0
- package/Runtime/CesiumPointCloudShading.cs.meta +11 -0
- package/Runtime/CesiumPolygonRasterOverlay.cs +109 -0
- package/Runtime/CesiumPolygonRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumPrimitiveFeatures.cs +130 -0
- package/Runtime/CesiumPrimitiveFeatures.cs.meta +11 -0
- package/Runtime/CesiumPropertyArray.cs +64 -0
- package/Runtime/CesiumPropertyArray.cs.meta +11 -0
- package/Runtime/CesiumPropertyTable.cs +126 -0
- package/Runtime/CesiumPropertyTable.cs.meta +11 -0
- package/Runtime/CesiumPropertyTableProperty.cs +1734 -0
- package/Runtime/CesiumPropertyTableProperty.cs.meta +11 -0
- package/Runtime/CesiumRasterOverlay.cs +239 -0
- package/Runtime/CesiumRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumRasterOverlayLoadFailureDetails.cs +65 -0
- package/Runtime/CesiumRasterOverlayLoadFailureDetails.cs.meta +11 -0
- package/Runtime/CesiumRuntime.asmdef +32 -0
- package/Runtime/CesiumRuntime.asmdef.meta +7 -0
- package/Runtime/CesiumRuntime.cs +3 -0
- package/Runtime/CesiumRuntime.cs.meta +11 -0
- package/Runtime/CesiumRuntimeSettings.cs +188 -0
- package/Runtime/CesiumRuntimeSettings.cs.meta +11 -0
- package/Runtime/CesiumSampleHeightResult.cs +47 -0
- package/Runtime/CesiumSampleHeightResult.cs.meta +11 -0
- package/Runtime/CesiumSimplePlanarEllipsoidCurve.cs +93 -0
- package/Runtime/CesiumSimplePlanarEllipsoidCurve.cs.meta +11 -0
- package/Runtime/CesiumSubScene.cs +473 -0
- package/Runtime/CesiumSubScene.cs.meta +11 -0
- package/Runtime/CesiumTileExcluder.cs +47 -0
- package/Runtime/CesiumTileExcluder.cs.meta +11 -0
- package/Runtime/CesiumTileMapServiceRasterOverlay.cs +93 -0
- package/Runtime/CesiumTileMapServiceRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumWebMapServiceRasterOverlay.cs +129 -0
- package/Runtime/CesiumWebMapServiceRasterOverlay.cs.meta +11 -0
- package/Runtime/CesiumWebMapTileServiceRasterOverlay.cs +414 -0
- package/Runtime/CesiumWebMapTileServiceRasterOverlay.cs.meta +3 -0
- package/Runtime/CesiumWgs84Ellipsoid.cs +75 -0
- package/Runtime/CesiumWgs84Ellipsoid.cs.meta +11 -0
- package/Runtime/ConfigureReinterop.cs +926 -0
- package/Runtime/ConfigureReinterop.cs.meta +11 -0
- package/Runtime/Helpers.cs +122 -0
- package/Runtime/Helpers.cs.meta +11 -0
- package/Runtime/ICesiumRestartable.cs +17 -0
- package/Runtime/ICesiumRestartable.cs.meta +11 -0
- package/Runtime/NativeCoroutine.cs +28 -0
- package/Runtime/NativeCoroutine.cs.meta +11 -0
- package/Runtime/NativeDownloadHandler.cs +29 -0
- package/Runtime/NativeDownloadHandler.cs.meta +11 -0
- package/Runtime/Resources/CesiumCreditSystem.prefab +78 -0
- package/Runtime/Resources/CesiumCreditSystem.prefab.meta +7 -0
- package/Runtime/Resources/CesiumCreditSystemRuntimeTheme.tss +2 -0
- package/Runtime/Resources/CesiumCreditSystemRuntimeTheme.tss.meta +11 -0
- package/Runtime/Resources/CesiumCreditSystemUI.uxml +4 -0
- package/Runtime/Resources/CesiumCreditSystemUI.uxml.meta +10 -0
- package/Runtime/Resources/CesiumCreditSystemUIPanelSettings.asset +38 -0
- package/Runtime/Resources/CesiumCreditSystemUIPanelSettings.asset.meta +8 -0
- package/Runtime/Resources/CesiumDefaultTilesetMaterial.mat +232 -0
- package/Runtime/Resources/CesiumDefaultTilesetMaterial.mat.meta +8 -0
- package/Runtime/Resources/CesiumDefaultTilesetShader.shadergraph +14271 -0
- package/Runtime/Resources/CesiumDefaultTilesetShader.shadergraph.meta +10 -0
- package/Runtime/Resources/CesiumPointCloudShading.hlsl +156 -0
- package/Runtime/Resources/CesiumPointCloudShading.hlsl.meta +7 -0
- package/Runtime/Resources/CesiumPointCloudShadingMaterial.mat +125 -0
- package/Runtime/Resources/CesiumPointCloudShadingMaterial.mat.meta +8 -0
- package/Runtime/Resources/CesiumPointCloudShadingShader.shader +73 -0
- package/Runtime/Resources/CesiumPointCloudShadingShader.shader.meta +10 -0
- package/Runtime/Resources/CesiumRasterOverlay.shadersubgraph +2207 -0
- package/Runtime/Resources/CesiumRasterOverlay.shadersubgraph.meta +10 -0
- package/Runtime/Resources/CesiumSelectTexCoords.shadersubgraph +722 -0
- package/Runtime/Resources/CesiumSelectTexCoords.shadersubgraph.meta +10 -0
- package/Runtime/Resources/CesiumUnlitTilesetMaterial.mat +261 -0
- package/Runtime/Resources/CesiumUnlitTilesetMaterial.mat.meta +8 -0
- package/Runtime/Resources/CesiumUnlitTilesetShader.shadergraph +5873 -0
- package/Runtime/Resources/CesiumUnlitTilesetShader.shadergraph.meta +10 -0
- package/Runtime/Resources/DynamicCamera.prefab +253 -0
- package/Runtime/Resources/DynamicCamera.prefab.meta +7 -0
- package/Runtime/Resources/TransformTextureCoordinates.shadersubgraph +2171 -0
- package/Runtime/Resources/TransformTextureCoordinates.shadersubgraph.meta +10 -0
- package/Runtime/Resources/green1x1.png +0 -0
- package/Runtime/Resources/green1x1.png.meta +123 -0
- package/Runtime/Resources.meta +8 -0
- package/Runtime/TestGltfModel.cs +56 -0
- package/Runtime/TestGltfModel.cs.meta +11 -0
- package/Runtime/TestReinterop.cs +21 -0
- package/Runtime/TestReinterop.cs.meta +11 -0
- package/Runtime/UnityLifetime.cs +27 -0
- package/Runtime/UnityLifetime.cs.meta +11 -0
- package/Runtime/WaitForTask.cs +25 -0
- package/Runtime/WaitForTask.cs.meta +11 -0
- package/Runtime/csc.rsp +1 -0
- package/Runtime/csc.rsp.meta +7 -0
- package/Runtime.meta +8 -0
- package/ThirdParty.json +27 -0
- package/ThirdParty.json.meta +7 -0
- package/WGS84.asset +18 -0
- package/WGS84.asset.meta +8 -0
- package/package.json +29 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,628 @@
|
|
|
1
|
+
using Reinterop;
|
|
2
|
+
using System;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using Unity.Mathematics;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace CesiumForUnity
|
|
8
|
+
{
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// An enumeration of the possible strategies for placing the origin of a <see cref="CesiumGeoreference"/>.
|
|
11
|
+
/// </summary>
|
|
12
|
+
public enum CesiumGeoreferenceOriginPlacement
|
|
13
|
+
{
|
|
14
|
+
/// <summary>
|
|
15
|
+
/// Use the tileset's true origin as the GameObject's origin.
|
|
16
|
+
/// </summary>
|
|
17
|
+
/// <remarks>
|
|
18
|
+
/// For georeferenced tilesets, this usually means the GameObject's origin will be
|
|
19
|
+
/// at the center of the Earth, which is not recommended. For a non-georeferenced
|
|
20
|
+
/// tileset, however, such as a detailed building with a local origin, putting the
|
|
21
|
+
/// GameObject's origin at the same location as the tileset's origin can be useful.
|
|
22
|
+
/// </remarks>
|
|
23
|
+
TrueOrigin,
|
|
24
|
+
/// <summary>
|
|
25
|
+
/// Use a custom position within the tileset as the GameObject's origin. The
|
|
26
|
+
/// position is expressed as cartographic coordinates determined by the
|
|
27
|
+
/// <see cref="CesiumGeoreference.originAuthority"/>, and that position within
|
|
28
|
+
/// the tileset will be at coordinate (0,0,0) in the GameObject's coordinate system.
|
|
29
|
+
/// </summary>
|
|
30
|
+
CartographicOrigin
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/// <summary>
|
|
34
|
+
/// Identifies the set of the coordinates that authoritatively define
|
|
35
|
+
/// the origin of a <see cref="CesiumGeoreference"/>.
|
|
36
|
+
/// </summary>
|
|
37
|
+
public enum CesiumGeoreferenceOriginAuthority
|
|
38
|
+
{
|
|
39
|
+
/// <summary>
|
|
40
|
+
/// The <see cref="CesiumGeoreference.longitude"/>, <see cref="CesiumGeoreference.latitude"/>,
|
|
41
|
+
/// and <see cref="CesiumGeoreference.height"/> properties authoritatively define the position
|
|
42
|
+
/// of this object.
|
|
43
|
+
/// </summary>
|
|
44
|
+
LongitudeLatitudeHeight,
|
|
45
|
+
|
|
46
|
+
/// <summary>
|
|
47
|
+
/// The <see cref="CesiumGeoreference.ecefX"/>, <see cref="CesiumGeoreference.ecefY"/>,
|
|
48
|
+
/// and <see cref="CesiumGeoreference.ecefZ"/> properties authoritatively define the position
|
|
49
|
+
/// of this object.
|
|
50
|
+
/// </summary>
|
|
51
|
+
EarthCenteredEarthFixed
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
/// Controls how global geospatial coordinates are mapped to coordinates in the Unity scene.
|
|
56
|
+
/// </summary>
|
|
57
|
+
/// <remarks>
|
|
58
|
+
/// <para>
|
|
59
|
+
/// This component should be added to a GameObject that is a parent of all GameObjects
|
|
60
|
+
/// with the <see cref="Cesium3DTileset"/> or <see cref="CesiumGlobeAnchor"/> components.
|
|
61
|
+
/// </para>
|
|
62
|
+
/// <para>
|
|
63
|
+
/// Internally, Cesium uses a global Earth-centered,
|
|
64
|
+
/// Earth-fixed (ECEF) ellipsoid-centered coordinate system, where the ellipsoid
|
|
65
|
+
/// is usually the World Geodetic System 1984 (WGS84) ellipsoid. This is a
|
|
66
|
+
/// right-handed system centered at the Earth's center of mass, where +X is in
|
|
67
|
+
/// the direction of the intersection of the Equator and the Prime Meridian (zero
|
|
68
|
+
/// degrees longitude), +Y is in the direction of the intersection of the Equator
|
|
69
|
+
/// and +90 degrees longitude, and +Z is through the North Pole.
|
|
70
|
+
/// </para>
|
|
71
|
+
/// <para>
|
|
72
|
+
/// This component controls how this coordinate system is mapped into the Unity world.
|
|
73
|
+
/// It creates a left-handed, Unity-friendly coordinate system centered at the specified
|
|
74
|
+
/// georeference origin, where +X points East, +Y points up, and +Z points North, and
|
|
75
|
+
/// transforms coordinates between that coordinate system and ECEF.
|
|
76
|
+
/// </para>
|
|
77
|
+
/// <para>
|
|
78
|
+
/// The Unity <code>Transform</code> is applied _after_ the georeference transformation,
|
|
79
|
+
/// in the normal way. For example, if a <see cref="Cesium3DTileset"/>'s <code>position</code>
|
|
80
|
+
/// property is set to <code>(5000.0, 100.0, 0.0)</code>, then that tileset will be shifted
|
|
81
|
+
/// East 5000 units and up 100 units. If the <see cref="CesiumGeoreference"/> has a scale of
|
|
82
|
+
/// 0.5, the entire globe will be half of its normal size in the Unity world.
|
|
83
|
+
/// </para>
|
|
84
|
+
/// </remarks>
|
|
85
|
+
[ExecuteInEditMode]
|
|
86
|
+
[ReinteropNativeImplementation("CesiumForUnityNative::CesiumGeoreferenceImpl", "CesiumGeoreferenceImpl.h")]
|
|
87
|
+
[AddComponentMenu("Cesium/Cesium Georeference")]
|
|
88
|
+
[IconAttribute("Packages/com.cesium.unity/Editor/Resources/Cesium-24x24.png")]
|
|
89
|
+
public partial class CesiumGeoreference : MonoBehaviour
|
|
90
|
+
{
|
|
91
|
+
#region Fields
|
|
92
|
+
[SerializeField]
|
|
93
|
+
private CesiumEllipsoid _ellipsoidOverride = null;
|
|
94
|
+
|
|
95
|
+
[SerializeField]
|
|
96
|
+
private CesiumGeoreferenceOriginPlacement _originPlacement = CesiumGeoreferenceOriginPlacement.CartographicOrigin;
|
|
97
|
+
|
|
98
|
+
[SerializeField]
|
|
99
|
+
private CesiumGeoreferenceOriginAuthority _originAuthority = CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight;
|
|
100
|
+
|
|
101
|
+
[SerializeField]
|
|
102
|
+
private double _latitude = 39.736401;
|
|
103
|
+
|
|
104
|
+
[SerializeField]
|
|
105
|
+
private double _longitude = -105.25737;
|
|
106
|
+
|
|
107
|
+
[SerializeField]
|
|
108
|
+
[Delayed]
|
|
109
|
+
private double _height = 2250.0;
|
|
110
|
+
|
|
111
|
+
[SerializeField]
|
|
112
|
+
[Delayed]
|
|
113
|
+
private double _ecefX = 6378137.0;
|
|
114
|
+
|
|
115
|
+
[SerializeField]
|
|
116
|
+
[Delayed]
|
|
117
|
+
private double _ecefY = 0.0;
|
|
118
|
+
|
|
119
|
+
[SerializeField]
|
|
120
|
+
[Delayed]
|
|
121
|
+
private double _ecefZ = 0.0;
|
|
122
|
+
|
|
123
|
+
[SerializeField]
|
|
124
|
+
private double _scale = 1.0;
|
|
125
|
+
|
|
126
|
+
[NonSerialized]
|
|
127
|
+
private double4x4 _localToEcef = double4x4.identity;
|
|
128
|
+
|
|
129
|
+
[NonSerialized]
|
|
130
|
+
private double4x4 _ecefToLocal = double4x4.identity;
|
|
131
|
+
|
|
132
|
+
[NonSerialized]
|
|
133
|
+
private bool _isInitialized = false;
|
|
134
|
+
|
|
135
|
+
[NonSerialized]
|
|
136
|
+
private HashSet<CesiumGlobeAnchor> _globeAnchors = new HashSet<CesiumGlobeAnchor>();
|
|
137
|
+
|
|
138
|
+
[NonSerialized]
|
|
139
|
+
private CesiumEllipsoid _ellipsoid = null;
|
|
140
|
+
|
|
141
|
+
#endregion
|
|
142
|
+
|
|
143
|
+
/// <summary>
|
|
144
|
+
/// The placement of this GameObject's origin (coordinate 0,0,0) within the tileset.
|
|
145
|
+
/// </summary>
|
|
146
|
+
/// <remarks>
|
|
147
|
+
/// 3D Tiles tilesets often use Earth-centered, Earth-fixed coordinates, such
|
|
148
|
+
/// that the tileset content is in a small bounding volume 6-7 million meters
|
|
149
|
+
/// (the radius of the Earth) away from the coordinate system origin. This
|
|
150
|
+
/// property allows an alternative position, other than the tileset's true
|
|
151
|
+
/// origin, to be treated as the origin for the purpose of this GameObject. Using
|
|
152
|
+
/// this property will preserve vertex precision (and thus avoid jittering)
|
|
153
|
+
/// much better than setting the GameObject's Transform property.
|
|
154
|
+
/// </remarks>
|
|
155
|
+
public CesiumGeoreferenceOriginPlacement originPlacement
|
|
156
|
+
{
|
|
157
|
+
get => this._originPlacement;
|
|
158
|
+
set
|
|
159
|
+
{
|
|
160
|
+
this._originPlacement = value;
|
|
161
|
+
this.MoveOrigin();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/// <summary>
|
|
166
|
+
/// Identifies which set of coordinates authoritatively defines the origin
|
|
167
|
+
/// of this georeference.
|
|
168
|
+
/// </summary>
|
|
169
|
+
/// <remarks>
|
|
170
|
+
/// Setting this property changes the <see cref="originPlacement"/> accordingly.
|
|
171
|
+
/// </remarks>
|
|
172
|
+
public CesiumGeoreferenceOriginAuthority originAuthority
|
|
173
|
+
{
|
|
174
|
+
get => this._originAuthority;
|
|
175
|
+
set
|
|
176
|
+
{
|
|
177
|
+
this._originAuthority = value;
|
|
178
|
+
this.originPlacement = CesiumGeoreferenceOriginPlacement.CartographicOrigin;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/// <summary>
|
|
183
|
+
/// The latitude of the origin of the coordinate system, in degrees, in the range -90 to 90.
|
|
184
|
+
/// </summary>
|
|
185
|
+
/// <remarks>
|
|
186
|
+
/// This property only takes effect if <see cref="CesiumGeoreference.originPlacement"/> is set to
|
|
187
|
+
/// <see cref="CesiumGeoreferenceOriginPlacement.CartographicOrigin"/> and
|
|
188
|
+
/// <see cref="originAuthority"/> is set to
|
|
189
|
+
/// <see cref="CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight"/>.
|
|
190
|
+
/// Setting this property changes the <see cref="originAuthority"/> accordingly.
|
|
191
|
+
/// </remarks>
|
|
192
|
+
public double latitude
|
|
193
|
+
{
|
|
194
|
+
get => this._latitude;
|
|
195
|
+
set
|
|
196
|
+
{
|
|
197
|
+
this._latitude = Math.Clamp(value, -90, 90);
|
|
198
|
+
this.originAuthority = CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/// <summary>
|
|
203
|
+
/// The longitude of the origin of the coordinate system, in degrees, in the range -180 to 180.
|
|
204
|
+
/// </summary>
|
|
205
|
+
/// <remarks>
|
|
206
|
+
/// This property only takes effect if <see cref="CesiumGeoreference.originPlacement"/> is set to
|
|
207
|
+
/// <see cref="CesiumGeoreferenceOriginPlacement.CartographicOrigin"/> and
|
|
208
|
+
/// <see cref="originAuthority"/> is set to
|
|
209
|
+
/// <see cref="CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight"/>.
|
|
210
|
+
/// Setting this property changes the <see cref="originAuthority"/> accordingly.
|
|
211
|
+
/// </remarks>
|
|
212
|
+
public double longitude
|
|
213
|
+
{
|
|
214
|
+
get => this._longitude;
|
|
215
|
+
set
|
|
216
|
+
{
|
|
217
|
+
this._longitude = Math.Clamp(value, -180, 180);
|
|
218
|
+
this.originAuthority = CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/// <summary>
|
|
223
|
+
/// The height in the origin of the coordinate system, in meters above the ellipsoid. Do not
|
|
224
|
+
/// confuse this with a geoid height or height above mean sea level, which can be tens of
|
|
225
|
+
/// meters higher or lower depending on where in the world the object is located.
|
|
226
|
+
/// </summary>
|
|
227
|
+
/// <remarks>
|
|
228
|
+
/// This property only takes effect if <see cref="CesiumGeoreference.originPlacement"/> is set to
|
|
229
|
+
/// <see cref="CesiumGeoreferenceOriginPlacement.CartographicOrigin"/> and
|
|
230
|
+
/// <see cref="originAuthority"/> is set to
|
|
231
|
+
/// <see cref="CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight"/>.
|
|
232
|
+
/// Setting this property changes the <see cref="originAuthority"/> accordingly.
|
|
233
|
+
/// </remarks>
|
|
234
|
+
public double height
|
|
235
|
+
{
|
|
236
|
+
get => this._height;
|
|
237
|
+
set
|
|
238
|
+
{
|
|
239
|
+
this._height = value;
|
|
240
|
+
this.originAuthority = CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/// <summary>
|
|
245
|
+
/// The Earth-Centered, Earth-Fixed X coordinate of the origin of the coordinate system, in meters.
|
|
246
|
+
/// </summary>
|
|
247
|
+
/// <remarks>
|
|
248
|
+
/// This property only takes effect if <see cref="CesiumGeoreference.originPlacement"/> is set to
|
|
249
|
+
/// <see cref="CesiumGeoreferenceOriginPlacement.CartographicOrigin"/> and
|
|
250
|
+
/// <see cref="originAuthority"/> is set to
|
|
251
|
+
/// <see cref="CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed"/>.
|
|
252
|
+
/// Setting this property changes the <see cref="originAuthority"/> accordingly.
|
|
253
|
+
/// </remarks>
|
|
254
|
+
public double ecefX
|
|
255
|
+
{
|
|
256
|
+
get => this._ecefX;
|
|
257
|
+
set
|
|
258
|
+
{
|
|
259
|
+
this._ecefX = value;
|
|
260
|
+
this.originAuthority = CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/// <summary>
|
|
265
|
+
/// The Earth-Centered, Earth-Fixed Y coordinate of the origin of the coordinate system, in meters.
|
|
266
|
+
/// </summary>
|
|
267
|
+
/// <remarks>
|
|
268
|
+
/// This property only takes effect if <see cref="CesiumGeoreference.originPlacement"/> is set to
|
|
269
|
+
/// <see cref="CesiumGeoreferenceOriginPlacement.CartographicOrigin"/> and
|
|
270
|
+
/// <see cref="originAuthority"/> is set to
|
|
271
|
+
/// <see cref="CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed"/>.
|
|
272
|
+
/// Setting this property changes the <see cref="originAuthority"/> accordingly.
|
|
273
|
+
/// </remarks>
|
|
274
|
+
public double ecefY
|
|
275
|
+
{
|
|
276
|
+
get => this._ecefY;
|
|
277
|
+
set
|
|
278
|
+
{
|
|
279
|
+
this._ecefY = value;
|
|
280
|
+
this.originAuthority = CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/// <summary>
|
|
285
|
+
/// The Earth-Centered, Earth-Fixed Z coordinate of the origin of the coordinate system, in meters.
|
|
286
|
+
/// </summary>
|
|
287
|
+
/// <remarks>
|
|
288
|
+
/// This property only takes effect if <see cref="CesiumGeoreference.originPlacement"/> is set to
|
|
289
|
+
/// <see cref="CesiumGeoreferenceOriginPlacement.CartographicOrigin"/> and
|
|
290
|
+
/// <see cref="originAuthority"/> is set to
|
|
291
|
+
/// <see cref="CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed"/>.
|
|
292
|
+
/// Setting this property changes the <see cref="originAuthority"/> accordingly.
|
|
293
|
+
/// </remarks>
|
|
294
|
+
public double ecefZ
|
|
295
|
+
{
|
|
296
|
+
get => this._ecefZ;
|
|
297
|
+
set
|
|
298
|
+
{
|
|
299
|
+
this._ecefZ = value;
|
|
300
|
+
this.originAuthority = CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/// <summary>
|
|
305
|
+
/// The scale of the globe in the Unity world. If this value is 0.5, for example, one
|
|
306
|
+
/// meter on the globe occupies half a meter in the Unity world.
|
|
307
|
+
/// </summary>
|
|
308
|
+
/// <remarks>
|
|
309
|
+
/// The globe can also be scaled by modifying the georeference's Transform, but setting
|
|
310
|
+
/// this property instead will do a better job of preserving precision.
|
|
311
|
+
/// </remarks>
|
|
312
|
+
public double scale
|
|
313
|
+
{
|
|
314
|
+
get => this._scale;
|
|
315
|
+
set
|
|
316
|
+
{
|
|
317
|
+
this._scale = value;
|
|
318
|
+
this.MoveOrigin();
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
public double4x4 localToEcefMatrix
|
|
323
|
+
{
|
|
324
|
+
get
|
|
325
|
+
{
|
|
326
|
+
this.Initialize();
|
|
327
|
+
return this._localToEcef;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
public double4x4 ecefToLocalMatrix
|
|
332
|
+
{
|
|
333
|
+
get
|
|
334
|
+
{
|
|
335
|
+
this.Initialize();
|
|
336
|
+
return this._ecefToLocal;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/// <summary>
|
|
341
|
+
/// The <see cref="CesiumEllipsoid"/> that is referenced.
|
|
342
|
+
/// </summary>
|
|
343
|
+
public CesiumEllipsoid ellipsoid
|
|
344
|
+
{
|
|
345
|
+
get
|
|
346
|
+
{
|
|
347
|
+
if (this._ellipsoid == null)
|
|
348
|
+
{
|
|
349
|
+
// Make a copy of the ellipsoid ScriptableObject
|
|
350
|
+
this._ellipsoid = ScriptableObject.CreateInstance<CesiumEllipsoid>();
|
|
351
|
+
this._ellipsoid.SetRadii((this._ellipsoidOverride ?? CesiumEllipsoid.WGS84).radii);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
return this._ellipsoid;
|
|
355
|
+
}
|
|
356
|
+
set
|
|
357
|
+
{
|
|
358
|
+
this._ellipsoid = value;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/// <summary>
|
|
363
|
+
/// An event raised when the georeference changes.
|
|
364
|
+
/// </summary>
|
|
365
|
+
[Tooltip("An event raised when the georeference origin changes.")]
|
|
366
|
+
public event Action changed;
|
|
367
|
+
|
|
368
|
+
/// <summary>
|
|
369
|
+
/// Sets the origin of the coordinate system to particular <see cref="ecefX"/>, <see cref="ecefY"/>,
|
|
370
|
+
/// <see cref="ecefZ"/> coordinates in the Earth-Centered, Earth-Fixed (ECEF) frame.
|
|
371
|
+
/// </summary>
|
|
372
|
+
/// <remarks>
|
|
373
|
+
/// Calling this method is more efficient than setting the properties individually.
|
|
374
|
+
/// </remarks>
|
|
375
|
+
/// <param name="x">The X coordinate in meters.</param>
|
|
376
|
+
/// <param name="y">The Y coordinate in meters.</param>
|
|
377
|
+
/// <param name="z">The Z coordinate in meters.</param>
|
|
378
|
+
public void SetOriginEarthCenteredEarthFixed(double x, double y, double z)
|
|
379
|
+
{
|
|
380
|
+
this._ecefX = x;
|
|
381
|
+
this._ecefY = y;
|
|
382
|
+
this._ecefZ = z;
|
|
383
|
+
this.originAuthority = CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/// <summary>
|
|
387
|
+
/// Sets the origin of the coordinate system to a particular <see cref="longitude"/>,
|
|
388
|
+
/// <see cref="latitude"/>, and <see cref="height"/>.
|
|
389
|
+
/// </summary>
|
|
390
|
+
/// <remarks>
|
|
391
|
+
/// Calling this method is more efficient than setting the properties individually.
|
|
392
|
+
/// </remarks>
|
|
393
|
+
/// <param name="longitude">The longitude in degrees, in the range -180 to 180.</param>
|
|
394
|
+
/// <param name="latitude">The latitude in degrees, in the range -90 to 90.</param>
|
|
395
|
+
/// <param name="height">
|
|
396
|
+
/// The height in meters above the ellipsoid. Do not confuse this with a geoid height
|
|
397
|
+
/// or height above mean sea level, which can be tens of meters higher or lower
|
|
398
|
+
/// depending on where in the world the object is located.
|
|
399
|
+
/// </param>
|
|
400
|
+
public void SetOriginLongitudeLatitudeHeight(double longitude, double latitude, double height)
|
|
401
|
+
{
|
|
402
|
+
this._longitude = longitude;
|
|
403
|
+
this._latitude = latitude;
|
|
404
|
+
this._height = height;
|
|
405
|
+
this.originAuthority = CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/// <summary>
|
|
409
|
+
/// Register a globe anchor with this georeference. When the georeference origin changes,
|
|
410
|
+
/// the registered anchor will be updated accordingly.
|
|
411
|
+
/// </summary>
|
|
412
|
+
/// <remarks>
|
|
413
|
+
/// This is called automatically by <see cref="CesiumGlobeAnchor.OnEnable"/> and usually
|
|
414
|
+
/// does not need to be called directly.
|
|
415
|
+
/// </remarks>
|
|
416
|
+
/// <param name="globeAnchor">The globe anchor.</param>
|
|
417
|
+
public void AddGlobeAnchor(CesiumGlobeAnchor globeAnchor)
|
|
418
|
+
{
|
|
419
|
+
this._globeAnchors.Add(globeAnchor);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/// <summary>
|
|
423
|
+
/// Deregisters a globe anchor with this georeference, so the globe anchor will no longer
|
|
424
|
+
/// be updated when the georeference origin changes.
|
|
425
|
+
/// </summary>
|
|
426
|
+
/// <remarks>
|
|
427
|
+
/// This is called automatically by <see cref="CesiumGlobeAnchor.OnDisable"/> and usually
|
|
428
|
+
/// does not need to be called directly.
|
|
429
|
+
/// </remarks>
|
|
430
|
+
/// <param name="globeAnchor">The globe anchor.</param>
|
|
431
|
+
public void RemoveGlobeAnchor(CesiumGlobeAnchor globeAnchor)
|
|
432
|
+
{
|
|
433
|
+
this._globeAnchors.Remove(globeAnchor);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/// <summary>
|
|
437
|
+
/// Initializes this georeference so that other objects may use it to locate the globe in the world.
|
|
438
|
+
/// </summary>
|
|
439
|
+
/// <remarks>
|
|
440
|
+
/// <para>
|
|
441
|
+
/// It is not usually necessary to call this directly because it is called automatically in
|
|
442
|
+
/// <see cref="OnEnable"/>. However, when other objects in the same scene need to use this
|
|
443
|
+
/// georeference from their own <code>OnEnable</code>, it is possible that the other object's
|
|
444
|
+
/// OnEnable will be called before the georeference's, leading to incorrect georeferencing.
|
|
445
|
+
/// Calling this method explicitly will avoid this problem.
|
|
446
|
+
/// </para>
|
|
447
|
+
/// <para>
|
|
448
|
+
/// However, this method should _not_ be called prior to the scene's <code>OnEnable</code> phase.
|
|
449
|
+
/// </para>
|
|
450
|
+
/// <para>
|
|
451
|
+
/// If this component has already been initialized, this method does nothing.
|
|
452
|
+
/// </para>
|
|
453
|
+
/// </remarks>
|
|
454
|
+
public void Initialize()
|
|
455
|
+
{
|
|
456
|
+
if (!this._isInitialized)
|
|
457
|
+
{
|
|
458
|
+
this._isInitialized = true;
|
|
459
|
+
this.UpdateOtherCoordinates();
|
|
460
|
+
this.UpdateTransformations();
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/// <summary>
|
|
465
|
+
/// Called when the ellipsoid override property has changed.
|
|
466
|
+
/// </summary>
|
|
467
|
+
public void ReloadEllipsoid()
|
|
468
|
+
{
|
|
469
|
+
// clear cached ellipsoid so it has to be rebuilt
|
|
470
|
+
this._ellipsoid = null;
|
|
471
|
+
this.UpdateTransformations();
|
|
472
|
+
this.UpdateOtherCoordinates();
|
|
473
|
+
|
|
474
|
+
Cesium3DTileset[] tilesets = GetComponentsInChildren<Cesium3DTileset>();
|
|
475
|
+
foreach (var tileset in tilesets)
|
|
476
|
+
{
|
|
477
|
+
tileset.RecreateTileset();
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
private void UpdateTransformations()
|
|
482
|
+
{
|
|
483
|
+
this._localToEcef = this.ComputeLocalToEarthCenteredEarthFixedTransformation();
|
|
484
|
+
this._ecefToLocal = math.inverse(this._localToEcef);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/// <summary>
|
|
488
|
+
/// Recomputes the coordinate system based on an updated origin. It is usually not
|
|
489
|
+
/// necessary to call this directly as it is called automatically when needed.
|
|
490
|
+
/// </summary>
|
|
491
|
+
public void MoveOrigin()
|
|
492
|
+
{
|
|
493
|
+
if (!this._isInitialized)
|
|
494
|
+
throw new InvalidOperationException("The origin of a CesiumGeoreference must not be set before its Initialize method is called, either explicitly or via OnEnable.");
|
|
495
|
+
|
|
496
|
+
// Scale must be greater than 0
|
|
497
|
+
if (this._scale < 1e-8)
|
|
498
|
+
this._scale = 1e-8;
|
|
499
|
+
|
|
500
|
+
this.UpdateOtherCoordinates();
|
|
501
|
+
|
|
502
|
+
double4x4 oldLocalToEcef = this._localToEcef;
|
|
503
|
+
|
|
504
|
+
this.UpdateTransformations();
|
|
505
|
+
|
|
506
|
+
if (oldLocalToEcef.Equals(this._localToEcef))
|
|
507
|
+
{
|
|
508
|
+
// Origin didn't change meaningfully.
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
foreach (CesiumGlobeAnchor anchor in this._globeAnchors)
|
|
513
|
+
{
|
|
514
|
+
if (anchor == null)
|
|
515
|
+
continue;
|
|
516
|
+
|
|
517
|
+
anchor.Sync();
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
if (this.changed != null)
|
|
521
|
+
{
|
|
522
|
+
this.changed();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
private void OnValidate()
|
|
527
|
+
{
|
|
528
|
+
if (this._isInitialized)
|
|
529
|
+
{
|
|
530
|
+
this.MoveOrigin();
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
private void OnEnable()
|
|
535
|
+
{
|
|
536
|
+
this.Initialize();
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
private void OnDisable()
|
|
540
|
+
{
|
|
541
|
+
this._isInitialized = false;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
private void UpdateOtherCoordinates()
|
|
545
|
+
{
|
|
546
|
+
if (this._originAuthority == CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight)
|
|
547
|
+
{
|
|
548
|
+
double3 ecef =
|
|
549
|
+
this.ellipsoid.LongitudeLatitudeHeightToCenteredFixed(
|
|
550
|
+
new double3(this._longitude, this._latitude, this._height));
|
|
551
|
+
this._ecefX = ecef.x;
|
|
552
|
+
this._ecefY = ecef.y;
|
|
553
|
+
this._ecefZ = ecef.z;
|
|
554
|
+
}
|
|
555
|
+
else if (this._originAuthority == CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed)
|
|
556
|
+
{
|
|
557
|
+
double3 llh =
|
|
558
|
+
this.ellipsoid.CenteredFixedToLongitudeLatitudeHeight(
|
|
559
|
+
new double3(this._ecefX, this._ecefY, this._ecefZ));
|
|
560
|
+
this._longitude = llh.x;
|
|
561
|
+
this._latitude = llh.y;
|
|
562
|
+
this._height = llh.z;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/// <summary>
|
|
567
|
+
/// Transform a Unity position to Earth-Centered, Earth-Fixed (ECEF) coordinates. The position should generally
|
|
568
|
+
/// not be a Unity _world_ position, but rather a position expressed in some parent GameObject's reference frame as
|
|
569
|
+
/// defined by its Transform. This way, the chain of Unity transforms places and orients the "globe" in the
|
|
570
|
+
/// Unity world.
|
|
571
|
+
/// </summary>
|
|
572
|
+
/// <param name="unityPosition">The Unity position to convert.</param>
|
|
573
|
+
/// <returns>The ECEF coordinates in meters.</returns>
|
|
574
|
+
public double3
|
|
575
|
+
TransformUnityPositionToEarthCenteredEarthFixed(double3 unityPosition)
|
|
576
|
+
{
|
|
577
|
+
this.Initialize();
|
|
578
|
+
return math.mul(this._localToEcef, new double4(unityPosition, 1.0)).xyz;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
/// <summary>
|
|
582
|
+
/// Transform an Earth-Centered, Earth-Fixed position to Unity coordinates. The resulting position should generally
|
|
583
|
+
/// not be interpreted as a Unity _world_ position, but rather a position expressed in some parent
|
|
584
|
+
/// GameObject's reference frame as defined by its Transform. This way, the chain of Unity transforms
|
|
585
|
+
/// places and orients the "globe" in the Unity world.
|
|
586
|
+
/// </summary>
|
|
587
|
+
/// <param name="earthCenteredEarthFixed">The ECEF coordinates in meters.</param>
|
|
588
|
+
/// <returns>The corresponding Unity coordinates.</returns>
|
|
589
|
+
public double3
|
|
590
|
+
TransformEarthCenteredEarthFixedPositionToUnity(double3 earthCenteredEarthFixed)
|
|
591
|
+
{
|
|
592
|
+
this.Initialize();
|
|
593
|
+
return math.mul(this._ecefToLocal, new double4(earthCenteredEarthFixed, 1.0)).xyz;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/// <summary>
|
|
597
|
+
/// Transform a Unity direction to a direction in Earth-Centered, Earth-Fixed (ECEF) coordinates. The
|
|
598
|
+
/// direction should generally not be a Unity _world_ direction, but rather a direction expressed in
|
|
599
|
+
/// some parent GameObject's reference frame as defined by its Transform. This way, the chain of
|
|
600
|
+
/// Unity transforms orients the "globe" in the Unity world.
|
|
601
|
+
/// </summary>
|
|
602
|
+
/// <param name="unityDirection">The Unity direction to convert.</param>
|
|
603
|
+
/// <returns>The ECEF direction.</returns>
|
|
604
|
+
public double3
|
|
605
|
+
TransformUnityDirectionToEarthCenteredEarthFixed(double3 unityDirection)
|
|
606
|
+
{
|
|
607
|
+
this.Initialize();
|
|
608
|
+
return math.mul(this._localToEcef, new double4(unityDirection, 0.0)).xyz;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/// <summary>
|
|
612
|
+
/// Transform an Earth-Centered, Earth-Fixed direction to Unity coordinates. The resulting direction
|
|
613
|
+
/// should generally not be interpreted as a Unity _world_ direction, but rather a direction expressed
|
|
614
|
+
/// in some parent GameObject's reference frame as defined by its Transform. This way, the chain of
|
|
615
|
+
/// Unity transforms orients the "globe" in the Unity world.
|
|
616
|
+
/// </summary>
|
|
617
|
+
/// <param name="earthCenteredEarthFixedDirection">The direction in ECEF coordinates.</param>
|
|
618
|
+
/// <returns>The corresponding Unity direction.</returns>
|
|
619
|
+
public double3
|
|
620
|
+
TransformEarthCenteredEarthFixedDirectionToUnity(double3 earthCenteredEarthFixedDirection)
|
|
621
|
+
{
|
|
622
|
+
this.Initialize();
|
|
623
|
+
return math.mul(this._ecefToLocal, new double4(earthCenteredEarthFixedDirection, 0.0)).xyz;
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
private partial double4x4 ComputeLocalToEarthCenteredEarthFixedTransformation();
|
|
627
|
+
}
|
|
628
|
+
}
|