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,277 @@
|
|
|
1
|
+
using UnityEditor;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
|
|
4
|
+
namespace CesiumForUnity
|
|
5
|
+
{
|
|
6
|
+
[CustomEditor(typeof(CesiumGeoreference))]
|
|
7
|
+
public class CesiumGeoreferenceEditor : Editor
|
|
8
|
+
{
|
|
9
|
+
private CesiumGeoreference _georeference;
|
|
10
|
+
|
|
11
|
+
private SerializedProperty _originPlacement;
|
|
12
|
+
|
|
13
|
+
// Converts the SerializedProperty's value to the CesiumGeoreferenceOriginPlacement
|
|
14
|
+
// enum it corresponds to, for convenience.
|
|
15
|
+
internal CesiumGeoreferenceOriginPlacement originPlacement
|
|
16
|
+
{
|
|
17
|
+
get
|
|
18
|
+
{
|
|
19
|
+
return (CesiumGeoreferenceOriginPlacement)
|
|
20
|
+
this._originPlacement.enumValueIndex;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private SerializedProperty _originAuthority;
|
|
25
|
+
|
|
26
|
+
// Converts the SerializedProperty's value to the CesiumGeoreferenceOriginAuthority
|
|
27
|
+
// enum it corresponds to, for convenience.
|
|
28
|
+
internal CesiumGeoreferenceOriginAuthority originAuthority
|
|
29
|
+
{
|
|
30
|
+
get
|
|
31
|
+
{
|
|
32
|
+
return (CesiumGeoreferenceOriginAuthority)
|
|
33
|
+
this._originAuthority.enumValueIndex;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private SerializedProperty _ellipsoidOverride;
|
|
38
|
+
private SerializedProperty _latitude;
|
|
39
|
+
private SerializedProperty _longitude;
|
|
40
|
+
private SerializedProperty _height;
|
|
41
|
+
|
|
42
|
+
private SerializedProperty _ecefX;
|
|
43
|
+
private SerializedProperty _ecefY;
|
|
44
|
+
private SerializedProperty _ecefZ;
|
|
45
|
+
|
|
46
|
+
private SerializedProperty _scale;
|
|
47
|
+
|
|
48
|
+
private void OnEnable()
|
|
49
|
+
{
|
|
50
|
+
this._georeference = (CesiumGeoreference)this.target;
|
|
51
|
+
|
|
52
|
+
this._ellipsoidOverride = this.serializedObject.FindProperty("_ellipsoidOverride");
|
|
53
|
+
this._originPlacement =
|
|
54
|
+
this.serializedObject.FindProperty("_originPlacement");
|
|
55
|
+
this._originAuthority =
|
|
56
|
+
this.serializedObject.FindProperty("_originAuthority");
|
|
57
|
+
|
|
58
|
+
this._latitude = this.serializedObject.FindProperty("_latitude");
|
|
59
|
+
this._longitude = this.serializedObject.FindProperty("_longitude");
|
|
60
|
+
this._height = this.serializedObject.FindProperty("_height");
|
|
61
|
+
|
|
62
|
+
this._ecefX = this.serializedObject.FindProperty("_ecefX");
|
|
63
|
+
this._ecefY = this.serializedObject.FindProperty("_ecefY");
|
|
64
|
+
this._ecefZ = this.serializedObject.FindProperty("_ecefZ");
|
|
65
|
+
|
|
66
|
+
this._scale = this.serializedObject.FindProperty("_scale");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public override void OnInspectorGUI()
|
|
70
|
+
{
|
|
71
|
+
this.serializedObject.Update();
|
|
72
|
+
|
|
73
|
+
DrawInspectorButtons();
|
|
74
|
+
EditorGUILayout.Space(5);
|
|
75
|
+
|
|
76
|
+
this.DrawOriginModeProperties();
|
|
77
|
+
EditorGUILayout.Space(5);
|
|
78
|
+
this.DrawLongitudeLatitudeHeightProperties();
|
|
79
|
+
EditorGUILayout.Space(5);
|
|
80
|
+
this.DrawEarthCenteredEarthFixedProperties();
|
|
81
|
+
EditorGUILayout.Space(5);
|
|
82
|
+
|
|
83
|
+
this.DrawScaleProperty();
|
|
84
|
+
this.DrawEllipsoidOverrideProperty();
|
|
85
|
+
|
|
86
|
+
this.serializedObject.ApplyModifiedProperties();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
private void DrawInspectorButtons()
|
|
90
|
+
{
|
|
91
|
+
// Don't modify the georeference if the editor is in play mode.
|
|
92
|
+
EditorGUI.BeginDisabledGroup(
|
|
93
|
+
EditorApplication.isPlaying
|
|
94
|
+
|| this.originPlacement != CesiumGeoreferenceOriginPlacement.CartographicOrigin);
|
|
95
|
+
|
|
96
|
+
GUILayout.BeginHorizontal();
|
|
97
|
+
GUIContent placeOriginHereContent = new GUIContent(
|
|
98
|
+
"Place Origin Here",
|
|
99
|
+
"Places the georeference origin at the camera's current location. " +
|
|
100
|
+
"Rotates the globe so the current longitude/latitude/height of the " +
|
|
101
|
+
"camera is at the Unity origin. The camera is also teleported to the " +
|
|
102
|
+
"Unity origin." +
|
|
103
|
+
"\n\n" +
|
|
104
|
+
"Warning: Before clicking, ensure that all non-Cesium objects in the " +
|
|
105
|
+
"persistent level are georeferenced with the \"CesiumGeoreference\" component " +
|
|
106
|
+
"or are children of a GameObject with that component. Ensure that static " +
|
|
107
|
+
"GameObjects only exist in georeferenced sub-scenes.");
|
|
108
|
+
if (GUILayout.Button(placeOriginHereContent))
|
|
109
|
+
{
|
|
110
|
+
CesiumEditorUtility.PlaceGeoreferenceAtCameraPosition(this._georeference);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
GUIContent createSubSceneContent = new GUIContent(
|
|
114
|
+
"Create Sub-Scene Here",
|
|
115
|
+
"Creates a child GameObject with a \"CesiumSubScene\" component whose origin " +
|
|
116
|
+
"is set to the camera's current location. A \"CesiumSubScene\" describes a " +
|
|
117
|
+
"corresponding world location that can be jumped to, and only one sub-scene " +
|
|
118
|
+
"can be worked on in the editor at a time." +
|
|
119
|
+
"\n\n" +
|
|
120
|
+
"This is disabled when \"Origin Placement\" is set to \"True Origin\".");
|
|
121
|
+
if (GUILayout.Button("Create Sub-Scene Here"))
|
|
122
|
+
{
|
|
123
|
+
CesiumEditorUtility.CreateSubScene(this._georeference);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
GUILayout.EndHorizontal();
|
|
127
|
+
|
|
128
|
+
EditorGUI.EndDisabledGroup();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
private void DrawOriginModeProperties()
|
|
132
|
+
{
|
|
133
|
+
GUILayout.Label("Origin Mode", EditorStyles.boldLabel);
|
|
134
|
+
|
|
135
|
+
GUIContent originPlacementContent = new GUIContent(
|
|
136
|
+
"Placement",
|
|
137
|
+
"The placement of this GameObject's origin (0,0,0) within the tileset." +
|
|
138
|
+
"\n\n" +
|
|
139
|
+
"3D Tiles tilesets often use Earth-centered, Earth-fixed coordinates, such that " +
|
|
140
|
+
"the tileset content is in a small bounding volume 6-7 million meters " +
|
|
141
|
+
"(the radius of the Earth) away from the coordinate system origin. This property " +
|
|
142
|
+
"allows an alternative position, other than the tileset's true origin, to be " +
|
|
143
|
+
"treated as the origin for the purpose of this GameObject. Using this property will " +
|
|
144
|
+
"preserve vertex precision (and thus avoid jittering) much better than setting the " +
|
|
145
|
+
"GameObject's Transform property.");
|
|
146
|
+
EditorGUILayout.PropertyField(this._originPlacement, originPlacementContent);
|
|
147
|
+
|
|
148
|
+
EditorGUI.BeginDisabledGroup(
|
|
149
|
+
this.originPlacement != CesiumGeoreferenceOriginPlacement.CartographicOrigin);
|
|
150
|
+
|
|
151
|
+
GUIContent originAuthorityContent = new GUIContent(
|
|
152
|
+
"Authority",
|
|
153
|
+
"The set of coordinates that authoritatively define the origin of " +
|
|
154
|
+
"this georeference.");
|
|
155
|
+
EditorGUILayout.PropertyField(this._originAuthority, originAuthorityContent);
|
|
156
|
+
|
|
157
|
+
EditorGUI.EndDisabledGroup();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
private void DrawEllipsoidOverrideProperty()
|
|
161
|
+
{
|
|
162
|
+
EditorGUI.BeginDisabledGroup(
|
|
163
|
+
this.originPlacement != CesiumGeoreferenceOriginPlacement.CartographicOrigin);
|
|
164
|
+
|
|
165
|
+
GUIContent ellipsoidOverrideContent = new GUIContent(
|
|
166
|
+
"Ellipsoid Override",
|
|
167
|
+
"The ellipsoid definition to use for this tileset. If this is left blank, " +
|
|
168
|
+
"the ellipsoid specified by the tileset is used, or WGS84 if the tileset " +
|
|
169
|
+
"doesn't list an ellipsoid to use.");
|
|
170
|
+
EditorGUI.BeginChangeCheck();
|
|
171
|
+
EditorGUILayout.PropertyField(this._ellipsoidOverride, ellipsoidOverrideContent);
|
|
172
|
+
if (EditorGUI.EndChangeCheck())
|
|
173
|
+
{
|
|
174
|
+
this.serializedObject.ApplyModifiedProperties();
|
|
175
|
+
this._georeference.ReloadEllipsoid();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
EditorGUI.EndDisabledGroup();
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
private void DrawScaleProperty()
|
|
182
|
+
{
|
|
183
|
+
GUIContent scaleContent = new GUIContent(
|
|
184
|
+
"Scale",
|
|
185
|
+
"The scale of the globe in the Unity world. If this value is 0.5, for " +
|
|
186
|
+
"example, one meter on the globe occupies half a meter in the Unity world. " +
|
|
187
|
+
"The globe can also be scaled by modifying the georeference's Transform, " +
|
|
188
|
+
"but setting this property instead will do a better job of preserving precision.");
|
|
189
|
+
EditorGUILayout.PropertyField(this._scale, scaleContent);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private void DrawLongitudeLatitudeHeightProperties()
|
|
193
|
+
{
|
|
194
|
+
CesiumGeoreferenceOriginPlacement placement = this.originPlacement;
|
|
195
|
+
CesiumGeoreferenceOriginAuthority authority = this.originAuthority;
|
|
196
|
+
EditorGUI.BeginDisabledGroup(
|
|
197
|
+
placement != CesiumGeoreferenceOriginPlacement.CartographicOrigin ||
|
|
198
|
+
authority != CesiumGeoreferenceOriginAuthority.LongitudeLatitudeHeight);
|
|
199
|
+
|
|
200
|
+
GUILayout.Label(
|
|
201
|
+
"Origin (Longitude Latitude Height)", EditorStyles.boldLabel);
|
|
202
|
+
|
|
203
|
+
GUIContent latitudeContent = new GUIContent(
|
|
204
|
+
"Latitude",
|
|
205
|
+
"The latitude of the origin in degrees, in the range [-90, 90].");
|
|
206
|
+
CesiumInspectorGUI.ClampedDoubleField(
|
|
207
|
+
this._latitude,
|
|
208
|
+
-90.0,
|
|
209
|
+
90.0,
|
|
210
|
+
latitudeContent,
|
|
211
|
+
delayed: true);
|
|
212
|
+
|
|
213
|
+
GUIContent longitudeContent = new GUIContent(
|
|
214
|
+
"Longitude",
|
|
215
|
+
"The longitude of the origin in degrees, in the range [-180, 180].");
|
|
216
|
+
CesiumInspectorGUI.ClampedDoubleField(
|
|
217
|
+
this._longitude,
|
|
218
|
+
-180.0,
|
|
219
|
+
180.0,
|
|
220
|
+
longitudeContent,
|
|
221
|
+
delayed: true);
|
|
222
|
+
|
|
223
|
+
GUIContent heightContent = new GUIContent(
|
|
224
|
+
"Height",
|
|
225
|
+
"The height of the origin in meters above the ellipsoid (usually WGS84)." +
|
|
226
|
+
"\n\n" +
|
|
227
|
+
"Do not confuse this with a geoid height or height above mean sea level, which " +
|
|
228
|
+
"can be tens of meters higher or lower depending on where in the world the " +
|
|
229
|
+
"origin is located.");
|
|
230
|
+
EditorGUILayout.PropertyField(this._height, heightContent);
|
|
231
|
+
|
|
232
|
+
EditorGUI.EndDisabledGroup();
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
private void DrawEarthCenteredEarthFixedProperties()
|
|
236
|
+
{
|
|
237
|
+
CesiumGeoreferenceOriginPlacement placement = this.originPlacement;
|
|
238
|
+
CesiumGeoreferenceOriginAuthority authority = this.originAuthority;
|
|
239
|
+
EditorGUI.BeginDisabledGroup(
|
|
240
|
+
placement != CesiumGeoreferenceOriginPlacement.CartographicOrigin ||
|
|
241
|
+
authority != CesiumGeoreferenceOriginAuthority.EarthCenteredEarthFixed);
|
|
242
|
+
|
|
243
|
+
GUILayout.Label(
|
|
244
|
+
"Origin (Earth Centered, Earth Fixed)", EditorStyles.boldLabel);
|
|
245
|
+
|
|
246
|
+
GUIContent ecefXContent = new GUIContent(
|
|
247
|
+
"ECEF X",
|
|
248
|
+
"The Earth-Centered, Earth-Fixed X-coordinate of the origin of this " +
|
|
249
|
+
"georeference in meters." +
|
|
250
|
+
"\n\n" +
|
|
251
|
+
"In the ECEF coordinate system, the origin is at the center of the Earth " +
|
|
252
|
+
"and the positive X axis points toward where the Prime Meridian crosses " +
|
|
253
|
+
"the Equator.");
|
|
254
|
+
EditorGUILayout.PropertyField(this._ecefX, ecefXContent);
|
|
255
|
+
|
|
256
|
+
GUIContent ecefYContent = new GUIContent(
|
|
257
|
+
"ECEF Y",
|
|
258
|
+
"The Earth-Centered, Earth-Fixed Y-coordinate of the origin of this " +
|
|
259
|
+
"georeference in meters." +
|
|
260
|
+
"\n\n" +
|
|
261
|
+
"In the ECEF coordinate system, the origin is at the center of the Earth " +
|
|
262
|
+
"and the positive Y axis points toward the Equator at 90 degrees longitude.");
|
|
263
|
+
EditorGUILayout.PropertyField(this._ecefY, ecefYContent);
|
|
264
|
+
|
|
265
|
+
GUIContent ecefZContent = new GUIContent(
|
|
266
|
+
"ECEF Z",
|
|
267
|
+
"The Earth-Centered, Earth-Fixed Z-coordinate of the origin of this " +
|
|
268
|
+
"georeference in meters." +
|
|
269
|
+
"\n\n" +
|
|
270
|
+
"In the ECEF coordinate system, the origin is at the center of the Earth " +
|
|
271
|
+
"and the positive Z axis points toward the North pole.");
|
|
272
|
+
EditorGUILayout.PropertyField(this._ecefZ, ecefZContent);
|
|
273
|
+
|
|
274
|
+
EditorGUI.EndDisabledGroup();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using Unity.Mathematics;
|
|
3
|
+
using UnityEditor;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
|
|
6
|
+
namespace CesiumForUnity
|
|
7
|
+
{
|
|
8
|
+
[CustomEditor(typeof(CesiumGlobeAnchor))]
|
|
9
|
+
public class CesiumGlobeAnchorEditor : Editor
|
|
10
|
+
{
|
|
11
|
+
private CesiumGlobeAnchor _globeAnchor;
|
|
12
|
+
private CesiumInspectorGUI _gui;
|
|
13
|
+
|
|
14
|
+
private void OnEnable()
|
|
15
|
+
{
|
|
16
|
+
this._globeAnchor = (CesiumGlobeAnchor)this.target;
|
|
17
|
+
this._gui = new CesiumInspectorGUI(this._globeAnchor);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private void OnDisable()
|
|
21
|
+
{
|
|
22
|
+
if (this._gui != null)
|
|
23
|
+
{
|
|
24
|
+
this._gui.Dispose();
|
|
25
|
+
this._gui = null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public override void OnInspectorGUI()
|
|
30
|
+
{
|
|
31
|
+
this.serializedObject.Update();
|
|
32
|
+
|
|
33
|
+
DrawGlobeAnchorProperties();
|
|
34
|
+
EditorGUILayout.Space(5);
|
|
35
|
+
DrawLongitudeLatitudeHeightProperties();
|
|
36
|
+
EditorGUILayout.Space(5);
|
|
37
|
+
DrawEarthCenteredEarthFixedProperties();
|
|
38
|
+
EditorGUILayout.Space(5);
|
|
39
|
+
DrawEastUpNorthRotationProperties();
|
|
40
|
+
EditorGUILayout.Space(5);
|
|
41
|
+
DrawScaleProperties();
|
|
42
|
+
|
|
43
|
+
this.serializedObject.ApplyModifiedProperties();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private static readonly string adjustOrientationForGlobeWhenMovingTooltip = CesiumEditorUtility.FormatTooltip(@"
|
|
47
|
+
Whether to adjust the game object's orientation based on globe curvature
|
|
48
|
+
as the game object moves.
|
|
49
|
+
|
|
50
|
+
The Earth is not flat, so as we move across its surface, the direction of
|
|
51
|
+
""up"" changes. If we ignore this fact and leave an object's orientation
|
|
52
|
+
unchanged as it moves over the globe surface, the object will become
|
|
53
|
+
increasingly tilted and eventually be completely upside-down when we arrive
|
|
54
|
+
at the opposite side of the globe.
|
|
55
|
+
|
|
56
|
+
When this setting is enabled, this component will automatically apply a
|
|
57
|
+
rotation to the Transform to account for globe curvature any time the game
|
|
58
|
+
object's position on the globe changes.
|
|
59
|
+
|
|
60
|
+
This property should usually be enabled, but it may be useful to disable it
|
|
61
|
+
when your application already accounts for globe curvature itself when it
|
|
62
|
+
updates a game object's transform, because in that case game object would
|
|
63
|
+
be over-rotated.");
|
|
64
|
+
|
|
65
|
+
private static readonly string detectTransformChangesTooltip = CesiumEditorUtility.FormatTooltip(@"
|
|
66
|
+
Whether this component should detect changes to the Transform component,
|
|
67
|
+
such as from physics, and update the precise coordinates accordingly.
|
|
68
|
+
Disabling this option improves performance for game objects that will not
|
|
69
|
+
move. Transform changes are always detected in Edit mode, no matter the
|
|
70
|
+
state of this flag.");
|
|
71
|
+
|
|
72
|
+
private void DrawGlobeAnchorProperties()
|
|
73
|
+
{
|
|
74
|
+
this._gui.Toggle(
|
|
75
|
+
"Adjust Orientation For Globe When Moving",
|
|
76
|
+
this._globeAnchor.adjustOrientationForGlobeWhenMoving,
|
|
77
|
+
(value) => this._globeAnchor.adjustOrientationForGlobeWhenMoving = value,
|
|
78
|
+
adjustOrientationForGlobeWhenMovingTooltip);
|
|
79
|
+
|
|
80
|
+
this._gui.Toggle(
|
|
81
|
+
"Detect Transform Changes",
|
|
82
|
+
this._globeAnchor.detectTransformChanges,
|
|
83
|
+
(value) => this._globeAnchor.detectTransformChanges = value,
|
|
84
|
+
detectTransformChangesTooltip);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private static readonly string longitudeLatitudeHeightTooltip = CesiumEditorUtility.FormatTooltip(@"
|
|
88
|
+
The Latitude, Longitude, and Height of this game object.
|
|
89
|
+
|
|
90
|
+
The Latitude (Lat) is expressed in degrees, in the range [-90, 90].
|
|
91
|
+
|
|
92
|
+
The Longitude (Lon) is expressed in degrees, in the range [-180, 180].
|
|
93
|
+
|
|
94
|
+
The Height (H) is expressed in meters above the ellipsoid (usually WGS84). Do not
|
|
95
|
+
confuse this with a geoid height or height above mean sea level, which
|
|
96
|
+
can be tens of meters higher or lower depending on where in the world the
|
|
97
|
+
object is located.");
|
|
98
|
+
|
|
99
|
+
private static readonly GUIContent latitudeContent = new GUIContent("Lat");
|
|
100
|
+
private static readonly GUIContent longitudeContent = new GUIContent("Lon");
|
|
101
|
+
private static readonly GUIContent heightContent = new GUIContent("H");
|
|
102
|
+
|
|
103
|
+
private void DrawLongitudeLatitudeHeightProperties()
|
|
104
|
+
{
|
|
105
|
+
double3 longitudeLatitudeHeight = this._globeAnchor.longitudeLatitudeHeight;
|
|
106
|
+
longitudeLatitudeHeight.x = Math.Round(longitudeLatitudeHeight.x, 8);
|
|
107
|
+
longitudeLatitudeHeight.y = Math.Round(longitudeLatitudeHeight.y, 8);
|
|
108
|
+
longitudeLatitudeHeight.z = Math.Round(longitudeLatitudeHeight.z, 4);
|
|
109
|
+
|
|
110
|
+
// Swap X and Y so that latitude is first, to match most users' intuitions.
|
|
111
|
+
longitudeLatitudeHeight = longitudeLatitudeHeight.yxz;
|
|
112
|
+
|
|
113
|
+
this._gui.Double3(
|
|
114
|
+
"Position (Latitude, Longitude, Height)",
|
|
115
|
+
longitudeLatitudeHeight,
|
|
116
|
+
(value) =>
|
|
117
|
+
{
|
|
118
|
+
this._globeAnchor.longitudeLatitudeHeight = value.yxz;
|
|
119
|
+
},
|
|
120
|
+
longitudeLatitudeHeightTooltip,
|
|
121
|
+
latitudeContent,
|
|
122
|
+
longitudeContent,
|
|
123
|
+
heightContent);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private static readonly string ecefTooltip = CesiumEditorUtility.FormatTooltip(@"
|
|
127
|
+
The Earth-Centered, Earth-Fixed (ECEF) coordinates of the origin of this
|
|
128
|
+
game object, in meters.
|
|
129
|
+
|
|
130
|
+
ECEF is a right-handed coordinate system with its origin at the
|
|
131
|
+
center of the Earth, the positive X axis pointing toward where the Prime
|
|
132
|
+
Meridian crosses the Equator, the positive Y axis pointing toward the
|
|
133
|
+
Equator at 90 degrees longitude, and the positive Z axis pointing toward
|
|
134
|
+
the North pole.");
|
|
135
|
+
|
|
136
|
+
private void DrawEarthCenteredEarthFixedProperties()
|
|
137
|
+
{
|
|
138
|
+
double3 ecefPosition = this._globeAnchor.positionGlobeFixed;
|
|
139
|
+
ecefPosition.x = Math.Round(ecefPosition.x, 4);
|
|
140
|
+
ecefPosition.y = Math.Round(ecefPosition.y, 4);
|
|
141
|
+
ecefPosition.z = Math.Round(ecefPosition.z, 4);
|
|
142
|
+
|
|
143
|
+
this._gui.Double3(
|
|
144
|
+
"Position (Earth-Centered, Earth-Fixed)",
|
|
145
|
+
ecefPosition,
|
|
146
|
+
(value) =>
|
|
147
|
+
{
|
|
148
|
+
this._globeAnchor.positionGlobeFixed = value;
|
|
149
|
+
},
|
|
150
|
+
ecefTooltip);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
private static readonly string rotationTooltip = CesiumEditorUtility.FormatTooltip(@"
|
|
154
|
+
The rotation of the object relative to the local East-Up-North
|
|
155
|
+
(EUN) frame centered at the object's position. In the EUN frame +X points East, +Y
|
|
156
|
+
points Up, and +Z points North.
|
|
157
|
+
|
|
158
|
+
These Euler angles are expressed in degrees and use Unity's normal ZXY convention.");
|
|
159
|
+
|
|
160
|
+
private void DrawEastUpNorthRotationProperties()
|
|
161
|
+
{
|
|
162
|
+
Quaternion rotation = this._globeAnchor.rotationEastUpNorth;
|
|
163
|
+
double3 eulerAngles = (float3)rotation.eulerAngles;
|
|
164
|
+
|
|
165
|
+
eulerAngles.x = Math.Round(Math.Clamp(Helpers.Negative180To180(eulerAngles.x), -180.0f, 180.0f), 4);
|
|
166
|
+
eulerAngles.y = Math.Round(Math.Clamp(Helpers.Negative180To180(eulerAngles.y), -180.0f, 180.0f), 4);
|
|
167
|
+
eulerAngles.z = Math.Round(Math.Clamp(Helpers.Negative180To180(eulerAngles.z), -180.0f, 180.0f), 4);
|
|
168
|
+
|
|
169
|
+
this._gui.Double3(
|
|
170
|
+
"Rotation (East-Up-North)",
|
|
171
|
+
eulerAngles,
|
|
172
|
+
(value) =>
|
|
173
|
+
{
|
|
174
|
+
rotation.eulerAngles = (float3)value;
|
|
175
|
+
this._globeAnchor.rotationEastUpNorth = rotation;
|
|
176
|
+
},
|
|
177
|
+
rotationTooltip);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private static readonly string scaleTooltip = CesiumEditorUtility.FormatTooltip(@"The local scaling of the object.");
|
|
181
|
+
|
|
182
|
+
private void DrawScaleProperties()
|
|
183
|
+
{
|
|
184
|
+
double3 scale = this._globeAnchor.scaleEastUpNorth;
|
|
185
|
+
scale.x = Math.Round(scale.x, 4);
|
|
186
|
+
scale.y = Math.Round(scale.y, 4);
|
|
187
|
+
scale.z = Math.Round(scale.z, 4);
|
|
188
|
+
|
|
189
|
+
this._gui.Double3(
|
|
190
|
+
"Scale",
|
|
191
|
+
scale,
|
|
192
|
+
(value) =>
|
|
193
|
+
{
|
|
194
|
+
// Don't try to set a scale that is too close to zero.
|
|
195
|
+
if (math.cmin(math.abs(value)) < 1.0e-15)
|
|
196
|
+
return;
|
|
197
|
+
this._globeAnchor.scaleEastUpNorth = value;
|
|
198
|
+
},
|
|
199
|
+
scaleTooltip);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
|
|
2
|
+
using System;
|
|
3
|
+
using Unity.Mathematics;
|
|
4
|
+
using UnityEditor;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
namespace CesiumForUnity
|
|
8
|
+
{
|
|
9
|
+
public class CesiumInspectorGUI : IDisposable
|
|
10
|
+
{
|
|
11
|
+
public UnityEngine.Object[] targets { get; private set; }
|
|
12
|
+
public int tooltipLabelWidth { get; set; } = 265;
|
|
13
|
+
|
|
14
|
+
private bool _ignoreModifications = false;
|
|
15
|
+
|
|
16
|
+
public CesiumInspectorGUI(params UnityEngine.Object[] targets)
|
|
17
|
+
{
|
|
18
|
+
this.targets = targets;
|
|
19
|
+
|
|
20
|
+
Undo.undoRedoPerformed += OnUndoRedoPerformed;
|
|
21
|
+
Undo.postprocessModifications += OnPostProcessModifications;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
~CesiumInspectorGUI()
|
|
25
|
+
{
|
|
26
|
+
Debug.Log("CesiumGUI was not disposed. Be sure to call Dispose in OnDisable.");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public void Dispose()
|
|
30
|
+
{
|
|
31
|
+
GC.SuppressFinalize(this);
|
|
32
|
+
Undo.undoRedoPerformed -= OnUndoRedoPerformed;
|
|
33
|
+
Undo.postprocessModifications -= OnPostProcessModifications;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public void Toggle(string label, bool value, Action<bool> set, string tooltip)
|
|
37
|
+
{
|
|
38
|
+
bool newValue = EditorGUILayout.Toggle(new GUIContent(label, tooltip), value);
|
|
39
|
+
if (newValue != value)
|
|
40
|
+
ApplyChange(label, newValue, set);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public void Double(string label, double value, Action<double> set, string tooltip)
|
|
44
|
+
{
|
|
45
|
+
double newValue = EditorGUILayout.DoubleField(new GUIContent(label, tooltip), value);
|
|
46
|
+
if (newValue != value)
|
|
47
|
+
ApplyChange(label, newValue, set);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
private static GUIContent defaultXContent = new GUIContent("X");
|
|
51
|
+
private static GUIContent defaultYContent = new GUIContent("Y");
|
|
52
|
+
private static GUIContent defaultZContent = new GUIContent("Z");
|
|
53
|
+
|
|
54
|
+
public void Double3(string label, double3 value, Action<double3> set, string tooltip, GUIContent xContent = null, GUIContent yContent = null, GUIContent zContent = null)
|
|
55
|
+
{
|
|
56
|
+
xContent = xContent ?? defaultXContent;
|
|
57
|
+
yContent = yContent ?? defaultYContent;
|
|
58
|
+
zContent = zContent ?? defaultZContent;
|
|
59
|
+
|
|
60
|
+
float originalLabelWidth = EditorGUIUtility.labelWidth;
|
|
61
|
+
|
|
62
|
+
GUIContent mainLabel = new GUIContent(label, tooltip);
|
|
63
|
+
bool mainLabelTooLong = EditorStyles.label.CalcSize(mainLabel).x + 4.0f > originalLabelWidth;
|
|
64
|
+
if (mainLabelTooLong)
|
|
65
|
+
GUILayout.Label(mainLabel);
|
|
66
|
+
|
|
67
|
+
using (new EditorGUILayout.HorizontalScope())
|
|
68
|
+
using (var changeScope = new EditorGUI.ChangeCheckScope())
|
|
69
|
+
{
|
|
70
|
+
if (!mainLabelTooLong)
|
|
71
|
+
EditorGUILayout.PrefixLabel(mainLabel);
|
|
72
|
+
|
|
73
|
+
EditorGUIUtility.labelWidth = EditorStyles.label.CalcSize(xContent).x + 4.0f;
|
|
74
|
+
value.x = EditorGUILayout.DoubleField(xContent, value.x);
|
|
75
|
+
EditorGUIUtility.labelWidth = EditorStyles.label.CalcSize(yContent).x + 4.0f;
|
|
76
|
+
value.y = EditorGUILayout.DoubleField(yContent, value.y);
|
|
77
|
+
EditorGUIUtility.labelWidth = EditorStyles.label.CalcSize(zContent).x + 4.0f;
|
|
78
|
+
value.z = EditorGUILayout.DoubleField(zContent, value.z);
|
|
79
|
+
|
|
80
|
+
if (changeScope.changed)
|
|
81
|
+
ApplyChange(label, value, set);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
EditorGUIUtility.labelWidth = originalLabelWidth;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public void Enum<T>(string label, T value, Action<T> set, string tooltip) where T : Enum
|
|
88
|
+
{
|
|
89
|
+
T newValue = (T)EditorGUILayout.EnumPopup(new GUIContent(label, tooltip), (Enum)value);
|
|
90
|
+
if (!value.Equals(newValue))
|
|
91
|
+
ApplyChange(label, newValue, set);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private void ApplyChange<T>(string label, T newValue, Action<T> set)
|
|
95
|
+
{
|
|
96
|
+
Undo.FlushUndoRecordObjects();
|
|
97
|
+
this._ignoreModifications = true;
|
|
98
|
+
try
|
|
99
|
+
{
|
|
100
|
+
Undo.RecordObjects(this.targets, "Changed " + label);
|
|
101
|
+
set(newValue);
|
|
102
|
+
Undo.FlushUndoRecordObjects();
|
|
103
|
+
}
|
|
104
|
+
finally
|
|
105
|
+
{
|
|
106
|
+
this._ignoreModifications = false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
public static void ClampedIntField(
|
|
111
|
+
SerializedProperty property, int min, int max, GUIContent label)
|
|
112
|
+
{
|
|
113
|
+
if (property.propertyType == SerializedPropertyType.Integer)
|
|
114
|
+
{
|
|
115
|
+
int value = EditorGUILayout.IntField(label, property.intValue);
|
|
116
|
+
property.intValue = Math.Clamp(value, min, max);
|
|
117
|
+
}
|
|
118
|
+
else
|
|
119
|
+
{
|
|
120
|
+
EditorGUILayout.LabelField(
|
|
121
|
+
label.text, "Use ClampedIntField for int only.");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public static void ClampedFloatField(
|
|
126
|
+
SerializedProperty property, float min, float max, GUIContent label)
|
|
127
|
+
{
|
|
128
|
+
if (property.propertyType == SerializedPropertyType.Float)
|
|
129
|
+
{
|
|
130
|
+
float value = EditorGUILayout.FloatField(label, property.floatValue);
|
|
131
|
+
property.floatValue = Math.Clamp(value, min, max);
|
|
132
|
+
}
|
|
133
|
+
else
|
|
134
|
+
{
|
|
135
|
+
EditorGUILayout.LabelField(
|
|
136
|
+
label.text, "Use ClampedFloatField for float only.");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
public static void ClampedDoubleField(
|
|
141
|
+
SerializedProperty property, double min, double max, GUIContent label, bool delayed = false)
|
|
142
|
+
{
|
|
143
|
+
// SerializedPropertyType.Float is used for both float and double;
|
|
144
|
+
// SerializedPropertyType.Double does not exist.
|
|
145
|
+
if (property.propertyType == SerializedPropertyType.Float)
|
|
146
|
+
{
|
|
147
|
+
double value;
|
|
148
|
+
if (delayed)
|
|
149
|
+
{
|
|
150
|
+
value = EditorGUILayout.DelayedDoubleField(label, property.doubleValue);
|
|
151
|
+
}
|
|
152
|
+
else
|
|
153
|
+
{
|
|
154
|
+
value = EditorGUILayout.DoubleField(label, property.doubleValue);
|
|
155
|
+
}
|
|
156
|
+
property.doubleValue = Math.Clamp(value, min, max);
|
|
157
|
+
}
|
|
158
|
+
else
|
|
159
|
+
{
|
|
160
|
+
EditorGUILayout.LabelField(
|
|
161
|
+
label.text, "Use ClampedDoubleField for double only.");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private UndoPropertyModification[] OnPostProcessModifications(UndoPropertyModification[] modifications)
|
|
166
|
+
{
|
|
167
|
+
if (!this._ignoreModifications)
|
|
168
|
+
this.RestartTargets();
|
|
169
|
+
|
|
170
|
+
return modifications;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private void OnUndoRedoPerformed()
|
|
174
|
+
{
|
|
175
|
+
this.RestartTargets();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private void RestartTargets()
|
|
179
|
+
{
|
|
180
|
+
foreach (UnityEngine.Object target in this.targets)
|
|
181
|
+
{
|
|
182
|
+
if (target is ICesiumRestartable restartable)
|
|
183
|
+
restartable.Restart();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|