Skip to content

Commit

Permalink
ARCore Extensions SDK v1.41.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fine committed Dec 7, 2023
1 parent 9dfa889 commit 7984b17
Show file tree
Hide file tree
Showing 58 changed files with 13,728 additions and 807 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dependencies>
<iosPods>
<iosPod name="ARCore/CloudAnchors" version="~> 1.40.0" minTargetSdk="12.0">
<iosPod name="ARCore/CloudAnchors" version="~> 1.41.0" minTargetSdk="12.0">
</iosPod>
</iosPods>
</dependencies>
2 changes: 1 addition & 1 deletion Editor/BuildResources/ARCoreiOSDependencies.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dependencies>
<iosPods>
<iosPod name="ARCore/GARSession" version="~> 1.40.0" minTargetSdk="12.0">
<iosPod name="ARCore/GARSession" version="~> 1.41.0" minTargetSdk="12.0">
</iosPod>
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dependencies>
<iosPods>
<iosPod name="ARCore/Geospatial" version="~> 1.40.0" minTargetSdk="12.0">
<iosPod name="ARCore/Geospatial" version="~> 1.41.0" minTargetSdk="12.0">
</iosPod>
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dependencies>
<iosPods>
<iosPod name="ARCore/Semantics" version="~> 1.39.0" minTargetSdk="12.0">
<iosPod name="ARCore/Semantics" version="~> 1.41.0" minTargetSdk="12.0">
</iosPod>
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@
"name": "com.unity.mathematics",
"expression": "1.2.0",
"define": "ARCORE_INTERNAL_USE_UNITY_MATH"
},
{
"name": "com.unity.xr.arfoundation",
"expression": "[5.0,6.0)",
"define": "ARCORE_USE_ARF_4"
},
{
"name": "com.unity.xr.arfoundation",
"expression": "[4.0,5.0)",
"define": "ARCORE_USE_ARF_4"
}
],
"noEngineReferences": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,36 @@ namespace Google.XR.ARCoreExtensions.GeospatialCreator.Editor
using UnityEditor;
using UnityEngine;

internal class GeospatialCreatorCesiumAdapter
public class GeospatialCreatorCesiumAdapter
{
/// <summary>
/// Static factory method to create an ARGeospatialCreatorOrigin at the given
/// latitude/longitude/altitude in the current Unity Scene. The Unity world coordinates
/// will be (0, 0, 0) and can be modified by accessing the returned object's transform.
/// </summary>
/// <remarks>
// This method is available only if the Cesium dependency is present in the project.
/// </remarks>
/// <param name = "latitude">The latitude at which to create the new origin, in decimal
/// degrees.</param>
/// <param name = "longitude">The longitude at which to create the new origin, in decimal
/// degrees.</param>
/// <param name = "altitude">The altitude at which to create the new origin, in meters
/// according to WGS84. </param>
public static ARGeospatialCreatorOrigin CreateOriginWithCesiumGeoreference(
double latitude, double longitude, double altitude, string mapTilesApiKey)
{
ARGeospatialCreatorOrigin origin =
new GameObject("GeospatialOrigin").AddComponent<ARGeospatialCreatorOrigin>();
origin.gameObject.tag = "EditorOnly";
origin.SetOriginPoint(latitude, longitude, altitude);

AddGeoreferenceAndTileset(origin);
Cesium3DTileset tileset = GetTilesetComponent(origin);
SetMapTileApiKeyForCesium3DTileset(tileset, mapTilesApiKey);

return origin;
}

internal static Cesium3DTileset GetTilesetComponent(ARGeospatialCreatorOrigin origin)
{
Expand Down Expand Up @@ -69,13 +97,31 @@ internal static CesiumGeoreference AddGeoreferenceAndTileset(
return georeference;
}

/// <summary>
/// Returns the Map Tiles API Key from the Cesium3DTileset in the Origin.
/// </summary>
/// <param name="origin"> A ARGeospatialCreatorOrigin that has a Cesium3DTileset child.
/// </param>
/// <returns> The Map Tiles API Key if the origin and its tileset aren't null,
/// else returns null. </returns>
internal static string GetMapTilesApiKey(ARGeospatialCreatorOrigin origin)
{
if (origin == null)
{
return null;
}
return GetMapTilesApiKey(GetTilesetComponent(origin));
}

/// <summary> Returns the Map Tiles API Key from the Cesium3DTileset.</summary>
/// <param name="tileset"> The Cesium3DTileset with a Map tiles API Key.</param>
/// <returns> The Map Tiles API Key if the tileset isn't null, else returns null. </returns>
internal static string GetMapTilesApiKey(Cesium3DTileset tileset)
{
if (tileset == null)
{
return null;
}
return MapTilesUtils.ExtractMapTilesApiKey(tileset.url);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@
namespace Google.XR.ARCoreExtensions.GeospatialCreator.Editor.Internal
{
using System;
using Google.XR.ARCoreExtensions.GeospatialCreator.Internal;
using Google.XR.ARCoreExtensions.GeospatialCreator;
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(ARGeospatialCreatorAnchor))]
[CanEditMultipleObjects]
internal class ARGeospatialCreatorAnchorEditor : Editor
{
private SerializedProperty _altitudeOffset;
private SerializedProperty _anchorManager;
private SerializedProperty _origin;
private SerializedProperty _useEditorAltitudeOverride;
private SerializedProperty _editorAltitudeOverride;

private SerializedProperty _altitudeType;
private SerializedProperty _latitude;
Expand All @@ -49,6 +52,17 @@ public override void OnInspectorGUI()
// Start a code block to check for GUI changes
EditorGUI.BeginChangeCheck();

GUIContent originLabel = new GUIContent("Geospatial Origin");
originLabel.tooltip = "The Origin is the reference point for converting real-world" +
" latitude, longitude, and altitude values to & from Unity game coordinates." +
" There should be exactly one ARGeospatialCreatorOrigin in your scene.";
EditorGUILayout.PropertyField(_origin, originLabel);

GUIContent anchorManagerLabel = new GUIContent("Anchor Manager",
"The ARAnchorManager used to resolve this anchor at runtime.");
EditorGUILayout.PropertyField(_anchorManager, anchorManagerLabel);

EditorGUILayout.Space();

_latitude.doubleValue =
EditorGUILayout.DoubleField("Latitude", _latitude.doubleValue);
Expand Down Expand Up @@ -79,41 +93,62 @@ private void GUIForAltitude(AnchorAltitudeType altitudeType)
{
using (new EditorGUI.IndentLevelScope())
{
// Draw the custom GUI for the legacy _altitudeOffset field
if (altitudeType == AnchorAltitudeType.Terrain ||
altitudeType == AnchorAltitudeType.Rooftop)
string altitudeLabel = string.Empty;
switch (altitudeType)
{
_altitudeOffset.doubleValue = EditorGUILayout.DoubleField(
"Altitude Offset",
_altitudeOffset.doubleValue);
case AnchorAltitudeType.WGS84:
altitudeLabel = "WGS84 altitude";
break;
case AnchorAltitudeType.Terrain:
altitudeLabel = "Altitude relative to terrain";
break;
case AnchorAltitudeType.Rooftop:
altitudeLabel = "Altitude relative to rooftop";
break;
}

_altitude.doubleValue =
EditorGUILayout.DoubleField("WGS84 Altitude", _altitude.doubleValue);
if (altitudeType == AnchorAltitudeType.Terrain)
{
EditorGUILayout.HelpBox("WGS84 Altitude is only used in the editor to " +
"display altitude of the anchored object. At runtime Altitude Offset is " +
"used to position the anchor relative to the terrain.",
MessageType.Info,
wide: true);
}
else if (altitudeType == AnchorAltitudeType.Rooftop)
EditorGUILayout.DoubleField(altitudeLabel, _altitude.doubleValue);

GUILayout.BeginHorizontal();

_useEditorAltitudeOverride.boolValue = EditorGUILayout.Toggle(
"Override altitude in Editor Scene View",
_useEditorAltitudeOverride.boolValue);

// Allow the override value to be edited only if the flag is enabled.
EditorGUI.BeginDisabledGroup(!_useEditorAltitudeOverride.boolValue);
_editorAltitudeOverride.doubleValue = EditorGUILayout.DoubleField(
_editorAltitudeOverride.doubleValue);
EditorGUI.EndDisabledGroup();

GUILayout.EndHorizontal();

if (_useEditorAltitudeOverride.boolValue)
{
EditorGUILayout.HelpBox("WGS84 Altitude is only used in the editor to " +
"display altitude of the anchored object. At runtime Altitude Offset is " +
"used to position the anchor relative to rooftops.",
EditorGUILayout.HelpBox(
"The Editor-only altitude override sets the altitude used in the Scene " +
"View to position the anchor, in meters according to WGS84. This is " +
"useful to vizualize the anchor relative to the scene geometry in cases " +
"where the scene geometry altitude is not fully aligned with the real " +
"world. This is an Editor-only property; the " + altitudeLabel + " is " +
"always used at runtime.",
MessageType.Info,
wide: true);
}

}
}

private void OnEnable()
{
// Fetch the objects from the GameObject script to display in the inspector
_altitudeType = serializedObject.FindProperty("_altitudeType");
_altitudeOffset = serializedObject.FindProperty("_altitudeOffset");
_anchorManager = serializedObject.FindProperty("_anchorManager");
_origin = serializedObject.FindProperty("Origin");
_useEditorAltitudeOverride =
serializedObject.FindProperty("_useEditorAltitudeOverride");
_editorAltitudeOverride = serializedObject.FindProperty("_editorAltitudeOverride");
_latitude = serializedObject.FindProperty("_latitude");
_longitude = serializedObject.FindProperty("_longitude");
_altitude = serializedObject.FindProperty("_altitude");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace Google.XR.ARCoreExtensions.GeospatialCreator.Editor.Internal
using CesiumForUnity;
#endif
using Google.XR.ARCoreExtensions.Editor.Internal;
using Google.XR.ARCoreExtensions.GeospatialCreator.Internal;
using Google.XR.ARCoreExtensions.GeospatialCreator;
using UnityEditor;
using UnityEngine;

Expand Down
Loading

0 comments on commit 7984b17

Please sign in to comment.