diff --git a/Editor/BuildResources/ARCoreiOSDependencies.template b/Editor/BuildResources/ARCoreiOSDependencies.template index c2aa227..5154204 100755 --- a/Editor/BuildResources/ARCoreiOSDependencies.template +++ b/Editor/BuildResources/ARCoreiOSDependencies.template @@ -1,6 +1,6 @@ - + diff --git a/Editor/Scripts/Internal/ARCoreExtensionsProjectSettings.cs b/Editor/Scripts/Internal/ARCoreExtensionsProjectSettings.cs index ec53a53..d34d82a 100755 --- a/Editor/Scripts/Internal/ARCoreExtensionsProjectSettings.cs +++ b/Editor/Scripts/Internal/ARCoreExtensionsProjectSettings.cs @@ -191,7 +191,7 @@ public void Save() } /// - /// Refelection function used by 'DisplayCondition' for property + /// Reflection function used by 'DisplayCondition' for property /// 'AndroidCloudServicesApiKey'. /// /// Display condition for 'AndroidCloudServicesApiKey'. @@ -209,7 +209,7 @@ public bool IsAndroidApiKeyFieldDisplayed() } /// - /// Refelection function used by 'DynamicHelp' for property + /// Reflection function used by 'DynamicHelp' for property /// 'AndroidAuthenticationStrategySetting'. /// /// Help info for 'AndroidAuthenticationStrategySetting'. @@ -229,7 +229,7 @@ public HelpAttribute GetAndroidStrategyHelpInfo() } /// - /// Refelection function used by 'EnumRange' for property + /// Reflection function used by 'EnumRange' for property /// 'AndroidAuthenticationStrategySetting'. /// /// Enum range for 'AndroidAuthenticationStrategySetting'. @@ -243,7 +243,7 @@ public Array GetAndroidStrategyRange() } /// - /// Refelection function used by 'DisplayCondition' for property + /// Reflection function used by 'DisplayCondition' for property /// 'IOSAuthenticationStrategySetting'. /// /// Display condition for 'IOSAuthenticationStrategySetting'. @@ -253,7 +253,7 @@ public bool IsIosStrategyDisplayed() } /// - /// Refelection function used by 'DisplayCondition' for property 'IOSCloudServicesApiKey'. + /// Reflection function used by 'DisplayCondition' for property 'IOSCloudServicesApiKey'. /// /// Display condition for 'IOSCloudServicesApiKey'. public bool IsIosApiKeyFieldDisplayed() @@ -275,7 +275,7 @@ public bool IsIosApiKeyFieldDisplayed() } /// - /// Refelection function used by 'EnumRange' for property 'IOSAuthenticationStrategy'. + /// Reflection function used by 'EnumRange' for property 'IOSAuthenticationStrategy'. /// /// Enum range for 'IOSAuthenticationStrategy'. public Array GetIosStrategyRange() @@ -288,7 +288,7 @@ public Array GetIosStrategyRange() } /// - /// Refelection function used by 'DynamicHelp' for property 'IOSAuthenticationStrategy'. + /// Reflection function used by 'DynamicHelp' for property 'IOSAuthenticationStrategy'. /// /// Help info for 'IOSAuthenticationStrategy'. public HelpAttribute GetIosStrategyHelpInfo() diff --git a/Editor/Scripts/Internal/AndroidDependenciesHelper.cs b/Editor/Scripts/Internal/AndroidDependenciesHelper.cs index 65e0138..bed2d01 100755 --- a/Editor/Scripts/Internal/AndroidDependenciesHelper.cs +++ b/Editor/Scripts/Internal/AndroidDependenciesHelper.cs @@ -30,7 +30,7 @@ namespace Google.XR.ARCoreExtensions.Editor.Internal /// This handles the addition and removal android dependencies, and run PlayServicesResolver /// plugin. /// - internal static class AndroidDependenciesHelper + public static class AndroidDependenciesHelper { private static readonly string _templateFileExtension = ".template"; private static readonly string _playServiceDependencyFileExtension = ".xml"; @@ -90,7 +90,8 @@ public static void UpdateAndroidDependencies(bool enabledDependencies, if (enabledDependencies && !File.Exists(dependenciesXMLPath)) { Debug.LogFormat( - "Adding {0}.", Path.GetFileNameWithoutExtension(dependenciesTemplatePath)); + "Adding {0}.", + System.IO.Path.GetFileNameWithoutExtension(dependenciesTemplatePath)); File.Copy(dependenciesTemplatePath, dependenciesXMLPath); AssetDatabase.Refresh(); @@ -98,7 +99,8 @@ public static void UpdateAndroidDependencies(bool enabledDependencies, else if (!enabledDependencies && File.Exists(dependenciesXMLPath)) { Debug.LogFormat( - "Removing {0}.", Path.GetFileNameWithoutExtension(dependenciesTemplatePath)); + "Removing {0}.", + System.IO.Path.GetFileNameWithoutExtension(dependenciesTemplatePath)); File.Delete(dependenciesXMLPath); File.Delete(dependenciesXMLPath + ".meta"); @@ -208,9 +210,9 @@ public static string GetJdkPath() } if (!string.IsNullOrEmpty(jdkPath) && - (File.GetAttributes(jdkPath) & FileAttributes.Directory) == 0) + (File.GetAttributes(jdkPath) & System.IO.FileAttributes.Directory) == 0) { - Debug.LogError(string.Format("Invalid JDK path '{0}'", jdkPath)); + Debug.LogErrorFormat("Invalid JDK path '{0}'", jdkPath); jdkPath = null; } diff --git a/Editor/Scripts/Internal/AndroidKeylessPreprocessBuild.cs b/Editor/Scripts/Internal/AndroidKeylessPreprocessBuild.cs index 96202fa..5ccfa6a 100755 --- a/Editor/Scripts/Internal/AndroidKeylessPreprocessBuild.cs +++ b/Editor/Scripts/Internal/AndroidKeylessPreprocessBuild.cs @@ -31,11 +31,14 @@ namespace Google.XR.ARCoreExtensions.Editor.Internal /// This handles the addition and removal of dependencies into the App's build. /// For BatchMode builds, perform clean after a build is complete. /// - internal class AndroidKeylessPreprocessBuild : IPreprocessBuildWithReport + public class AndroidKeylessPreprocessBuild : IPreprocessBuildWithReport { private const string _androidKeylessPluginGuid = "aafa8cb6617464d6290c8fdfb9607794"; private const string _androidKeylessDependenciesGuid = "1fc346056f53a42949a3dcadaae39d67"; + /// + /// Gets Callback order. + /// [SuppressMessage("UnityRules.UnityStyleRules", "US1109:PublicPropertiesMustBeUpperCamelCase", Justification = "Overriden property.")] public int callbackOrder @@ -46,6 +49,11 @@ public int callbackOrder } } + /// + /// Callback after the build is done. + /// + /// Build target platform. + /// Path to build project. [PostProcessBuild(1)] public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProject) { @@ -55,6 +63,29 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj } } + /// + /// Preprocess step for Android Build. + /// + /// Whether to enable or disable keyless. + public static void PreprocessAndroidBuild(bool enabledKeyless) + { + AndroidDependenciesHelper.SetAndroidPluginEnabled( + enabledKeyless, _androidKeylessPluginGuid); + AndroidDependenciesHelper.UpdateAndroidDependencies( + enabledKeyless, _androidKeylessDependenciesGuid); + + if (enabledKeyless) + { + Debug.Log("ARCoreExtensions: Including Keyless dependencies in this build."); + AndroidDependenciesHelper.DoPlayServicesResolve(); + } + } + + /// + /// Callback before the build is started. + /// + /// A report containing information about the build, + /// such as its target platform and output path. public void OnPreprocessBuild(BuildReport report) { if (report.summary.platform == BuildTarget.Android) @@ -69,20 +100,6 @@ public void OnPreprocessBuild(BuildReport report) } } - private static void PreprocessAndroidBuild(bool enabledKeyless) - { - AndroidDependenciesHelper.SetAndroidPluginEnabled( - enabledKeyless, _androidKeylessPluginGuid); - AndroidDependenciesHelper.UpdateAndroidDependencies( - enabledKeyless, _androidKeylessDependenciesGuid); - - if (enabledKeyless) - { - Debug.Log("ARCoreExtensions: Including Keyless dependencies in this build."); - AndroidDependenciesHelper.DoPlayServicesResolve(); - } - } - private static void PostprocessAndroidBuild() { Debug.Log("ARCoreExtensions: Cleaning up Keyless dependencies."); diff --git a/Editor/Scripts/Internal/AndroidSupportPreprocessBuild.cs b/Editor/Scripts/Internal/AndroidSupportPreprocessBuild.cs index 36f9d0d..b719353 100755 --- a/Editor/Scripts/Internal/AndroidSupportPreprocessBuild.cs +++ b/Editor/Scripts/Internal/AndroidSupportPreprocessBuild.cs @@ -22,7 +22,6 @@ namespace Google.XR.ARCoreExtensions.Editor.Internal { using System.Diagnostics.CodeAnalysis; using System.IO; - using System.Text; using UnityEditor; using UnityEditor.Build; using UnityEditor.Build.Reporting; @@ -31,13 +30,19 @@ namespace Google.XR.ARCoreExtensions.Editor.Internal using UnityEngine.XR.ARCore; using UnityEngine.XR.Management; - internal class AndroidSupportPreprocessBuild : IPreprocessBuildWithReport + /// + /// Preprocess build to check android support. + /// + public class AndroidSupportPreprocessBuild : IPreprocessBuildWithReport { - private const string _mainTempatePath = "Plugins/Android/mainTemplate.gradle"; + private const string _mainTemplatePath = "Plugins/Android/mainTemplate.gradle"; private const string _launcherTemplatePath = "Plugins/Android/launcherTemplate.gradle"; - [SuppressMessage("UnityRules.UnityStyleRules", - "US1109:PublicPropertiesMustBeUpperCamelCase", + /// + /// Gets the relative callback order for callbacks. Callbacks with lower values are called + /// before ones with higher values. + /// + [SuppressMessage("UnityRules.UnityStyleRules", "US1109:PublicPropertiesMustBeUpperCamelCase", Justification = "Overriden property.")] public int callbackOrder { @@ -47,9 +52,16 @@ public int callbackOrder } } + /// + /// A callback received before the build is started. + /// + /// A report containing information about the build, + /// such as its target platform and output path. public void OnPreprocessBuild(BuildReport report) { +#if !ARCORE_FEATURE_UNIT_TEST // BuildReport is unavailable on Test Welder. if (report.summary.platform == BuildTarget.Android) +#endif { if (!CheckARCoreLoader()) { @@ -117,7 +129,7 @@ private void CheckGradleTemplate() // Need to use gradle plugin version >= 3.6.0 in main gradle by editing // 'Assets/Plugins/Android/mainTemplate.gradle'. - if (!File.Exists(Path.Combine(Application.dataPath, _mainTempatePath))) + if (!File.Exists(Path.Combine(Application.dataPath, _mainTemplatePath))) { throw new BuildFailedException( "Main Gradle template is not used in this build. " + diff --git a/Editor/Scripts/Internal/IOSSupportHelper.cs b/Editor/Scripts/Internal/IOSSupportHelper.cs index 1816129..083b9e6 100755 --- a/Editor/Scripts/Internal/IOSSupportHelper.cs +++ b/Editor/Scripts/Internal/IOSSupportHelper.cs @@ -24,7 +24,10 @@ namespace Google.XR.ARCoreExtensions.Editor.Internal using UnityEditor; using UnityEngine; - internal static class IOSSupportHelper + /// + /// IOS support helper class. + /// + public static class IOSSupportHelper { // GUID of folder [ARCore Extensions Package]/Editor/BuildResources/ private const string _arCoreIOSDependencyFolderGUID = "117437286c43f4eeb845c3257f2a8546"; @@ -32,6 +35,11 @@ internal static class IOSSupportHelper private const string _arCoreIOSDependencyFileName = "ARCoreiOSDependencies"; private const string _arCoreExtensionIOSSupportSymbol = "ARCORE_EXTENSIONS_IOS_SUPPORT"; + /// + /// Enables ARCore iOS Support in Extensions. + /// + /// Indicates whether to enable or disable iOS support. + /// public static void SetARCoreIOSSupportEnabled(bool arcoreIOSEnabled) { if (arcoreIOSEnabled) @@ -50,6 +58,12 @@ public static void SetARCoreIOSSupportEnabled(bool arcoreIOSEnabled) UpdateIOSPodDependencies(arcoreIOSEnabled, _arCoreIOSDependencyFileName); } + /// + /// Updates the iOS pod dependency based on iOS support state. + /// + /// Enable or disable the dependency. + /// + /// The file name of the dependency template. public static void UpdateIOSPodDependencies(bool arcoreIOSEnabled, string dependencyFileName) { diff --git a/Editor/Scripts/Internal/PropertyDrawers/EnumFlagsAttributeDrawer.cs b/Editor/Scripts/Internal/PropertyDrawers/EnumFlagsAttributeDrawer.cs new file mode 100755 index 0000000..5a22e66 --- /dev/null +++ b/Editor/Scripts/Internal/PropertyDrawers/EnumFlagsAttributeDrawer.cs @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions.Editor.Internal +{ + using System; + using Google.XR.ARCoreExtensions.Internal; + using UnityEditor; + using UnityEngine; + + /// + /// EnumFlagsAttribute drawer that draws a mask field and calculate the int value based on + /// current enum values. + /// + [CustomPropertyDrawer(typeof(EnumFlagsAttribute))] + public class EnumFlagsAttributeDrawer : PropertyDrawer + { + /// + /// Override Unity OnGUI to make a custom GUI for the property with EnumFlagsAttribute. + /// + /// Rectangle on the screen to use for the property GUI. + /// The SerializedProperty to make the custom GUI for. + /// The label of this property. + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + EnumFlagsAttribute flagsAttribute = attribute as EnumFlagsAttribute; + + string[] itemNames = Enum.GetNames(flagsAttribute.EnumType); + int[] itemValues = Enum.GetValues(flagsAttribute.EnumType) as int[]; + + property.intValue = + EditorGUI.MaskField(position, label, property.intValue, itemNames); + + if (property.intValue == -1) + { + int maskValue = 0; + foreach (int itemValue in itemValues) + { + maskValue |= itemValue; + } + + property.intValue = maskValue; + } + } + } +} diff --git a/Editor/Scripts/Internal/PropertyDrawers/EnumFlagsAttributeDrawer.cs.meta b/Editor/Scripts/Internal/PropertyDrawers/EnumFlagsAttributeDrawer.cs.meta new file mode 100755 index 0000000..8ca25b1 --- /dev/null +++ b/Editor/Scripts/Internal/PropertyDrawers/EnumFlagsAttributeDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f0978d695433a4a73b7412778cd1b9e4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/ARPresto.aar b/Runtime/Plugins/ARPresto.aar index 33c4e4d..ca93eea 100755 Binary files a/Runtime/Plugins/ARPresto.aar and b/Runtime/Plugins/ARPresto.aar differ diff --git a/Runtime/Plugins/arcore_client.aar b/Runtime/Plugins/arcore_client.aar index d8f19ff..f40ab87 100755 Binary files a/Runtime/Plugins/arcore_client.aar and b/Runtime/Plugins/arcore_client.aar differ diff --git a/Runtime/Plugins/cloud_anchor_manifest.aar b/Runtime/Plugins/cloud_anchor_manifest.aar index 6e7900e..1184220 100644 Binary files a/Runtime/Plugins/cloud_anchor_manifest.aar and b/Runtime/Plugins/cloud_anchor_manifest.aar differ diff --git a/Runtime/Plugins/cloud_anchor_manifest.aar.meta b/Runtime/Plugins/cloud_anchor_manifest.aar.meta index 84c3ba2..afacbdf 100644 --- a/Runtime/Plugins/cloud_anchor_manifest.aar.meta +++ b/Runtime/Plugins/cloud_anchor_manifest.aar.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 92dcbef76766d4294be5eeebb710d7c0 +guid: 8e289493b6cf640e491c9288277d7029 PluginImporter: externalObjects: {} serializedVersion: 2 diff --git a/Runtime/Plugins/keyless_authentication.aar b/Runtime/Plugins/keyless_authentication.aar index d260131..72f5393 100755 Binary files a/Runtime/Plugins/keyless_authentication.aar and b/Runtime/Plugins/keyless_authentication.aar differ diff --git a/Runtime/Scripts/ARCoreExtensions.cs b/Runtime/Scripts/ARCoreExtensions.cs index cf962f8..6e90617 100755 --- a/Runtime/Scripts/ARCoreExtensions.cs +++ b/Runtime/Scripts/ARCoreExtensions.cs @@ -24,12 +24,15 @@ namespace Google.XR.ARCoreExtensions using System.Collections.Generic; using System.Linq; using Google.XR.ARCoreExtensions.Internal; + using Unity.Collections; using UnityEngine; #if UNITY_ANDROID using UnityEngine.XR.ARCore; #endif // UNITY_ANDROID using UnityEngine.XR.ARFoundation; + using UnityEngine.XR.ARSubsystems; + /// /// ARCore Extensions, this script allows an app to specify and provide access to @@ -58,11 +61,54 @@ public class ARCoreExtensions : MonoBehaviour /// public ARCoreExtensionsConfig ARCoreExtensionsConfig; + /// + /// The to define the set of properties + /// desired or required by the app to run. + /// + [Tooltip("Configuration options to select the camera mode and features.")] + public ARCoreExtensionsCameraConfigFilter CameraConfigFilter; + + /// + /// The callback event that allows a camera configuration to be selected from + /// a list of valid configurations. + /// The callback should be registered before the ARCore session is enabled + /// (e.g. Unity's Awake() method) to ensure it is triggered on the first + /// frame update. + /// + [HideInInspector] + public OnChooseXRCameraConfigurationEvent OnChooseXRCameraConfiguration; + + /// + /// Selects a camera configuration for the ARCore session to use. + /// + /// A list of supported camera configurations. + /// The size is dependent on settings. + /// The GPU texture resolutions are the same in all configs. + /// Currently, most devices provide GPU texture resolution of 1920 x 1080, but devices + /// might provide higher or lower resolution textures, depending on device capabilities. + /// The CPU image resolutions returned are VGA, 720p, and a resolution matching + /// the GPU texture, typically the native resolution of the device. + /// The index of the camera configuration in supportedConfigurations to be + /// used for the ARCore session. If the return value is not a valid index + /// (e.g. the value -1), then no camera configuration will be set and the ARCore session + /// will use the previously selected camera configuration or a default configuration + /// if no previous selection exists. + public delegate int OnChooseXRCameraConfigurationEvent( + List supportedConfigurations); + #if UNITY_ANDROID private string _currentPermissionRequest = null; private HashSet _requiredPermissionNames = new HashSet(); + private ARCoreSessionSubsystem _arCoreSubsystem; + + private ARCoreExtensionsConfig _cachedConfig = null; + + private ARCoreCameraSubsystem _arCoreCameraSubsystem; + + private ARCoreExtensionsCameraConfigFilter _cachedFilter = null; + #endif internal static ARCoreExtensions _instance { get; private set; } @@ -86,12 +132,6 @@ internal IntPtr currentARCoreSessionHandle } } -#if UNITY_ANDROID - private ARCoreSessionSubsystem _arCoreSubsystem; - - private ARCoreExtensionsConfig _cachedConfig = null; -#endif - /// /// Unity's Awake method. /// @@ -143,6 +183,18 @@ public void OnEnable() { _arCoreSubsystem.beforeSetConfiguration += BeforeConfigurationChanged; } + + _arCoreCameraSubsystem = (ARCoreCameraSubsystem)CameraManager.subsystem; + if (_arCoreCameraSubsystem == null) + { + Debug.LogError( + "No active ARCoreCameraSubsystem is available in this session, Please " + + "ensure that a valid loader configuration exists in the XR project settings."); + } + else + { + _arCoreCameraSubsystem.beforeGetCameraConfiguration += BeforeGetCameraConfiguration; + } #endif // UNITY_ANDROID CachedData.Reset(); @@ -161,6 +213,11 @@ public void OnDisable() { _arCoreSubsystem.beforeSetConfiguration -= BeforeConfigurationChanged; } + + if (_arCoreCameraSubsystem != null) + { + _arCoreCameraSubsystem.beforeGetCameraConfiguration -= BeforeGetCameraConfiguration; + } #endif // UNITY_ANDROID CachedData.Reset(); @@ -192,14 +249,26 @@ public void Update() RequestPermission(); } - // Update ARCore session configuration. - if (Session.SessionHandle() != IntPtr.Zero && ARCoreExtensionsConfig != null) + if (Session.SessionHandle() == IntPtr.Zero) { - if (_cachedConfig != null && _cachedConfig.Equals(ARCoreExtensionsConfig)) - { - return; - } + return; + } + // Update camera config filter + if (CameraConfigFilter != null && !CameraConfigFilter.Equals(_cachedFilter)) + { + _cachedFilter = + ScriptableObject.CreateInstance(); + _cachedFilter.CopyFrom(CameraConfigFilter); + + // Extensions will attempt to select the camera config based on the filter + // if it's in use, otherwise, relies on AR Foundation's default behavior. + SelectCameraConfig(); + } + + // Update session configuration. + if (ARCoreExtensionsConfig != null && !ARCoreExtensionsConfig.Equals(_cachedConfig)) + { _cachedConfig = ScriptableObject.CreateInstance(); _cachedConfig.CopyFrom(ARCoreExtensionsConfig); @@ -224,12 +293,6 @@ public void OnValidate() private void RequestPermission() { - // All required permissions are granted. - if (_requiredPermissionNames.Count == 0) - { - return; - } - // Waiting for current request. if (!AndroidPermissionsManager.IsPermissionGranted( AndroidPermissionsManager._cameraPermission) || @@ -245,12 +308,6 @@ private void RequestPermission() private void OnPermissionRequestFinish(bool isGranted) { - if (_currentPermissionRequest == null) - { - Debug.LogWarning("Received unexpected permission request result."); - return; - } - Debug.LogFormat("{0} {1}.", isGranted ? "Granted" : "Denied", _currentPermissionRequest); _requiredPermissionNames.Remove(_currentPermissionRequest); @@ -265,11 +322,73 @@ private void BeforeConfigurationChanged(ARCoreBeforeSetConfigurationEventArgs ev return; } - if (eventArgs.session != IntPtr.Zero && eventArgs.config != IntPtr.Zero) + if (eventArgs.arSession.AsIntPtr() != IntPtr.Zero && + eventArgs.arConfig.AsIntPtr() != IntPtr.Zero) { - SessionApi.UpdateSessionConfig(eventArgs.session, eventArgs.config, _cachedConfig); + SessionApi.UpdateSessionConfig( + eventArgs.arSession.AsIntPtr(), eventArgs.arConfig.AsIntPtr(), _cachedConfig); } } -#endif + + private void BeforeGetCameraConfiguration( + ARCoreBeforeGetCameraConfigurationEventArgs eventArgs) + { + if (CameraConfigFilter == null) + { + return; + } + + if (eventArgs.session.AsIntPtr() != IntPtr.Zero && + eventArgs.filter.AsIntPtr() != IntPtr.Zero) + { + CameraConfigFilterApi.UpdateFilter( + eventArgs.session.AsIntPtr(), eventArgs.filter.AsIntPtr(), CameraConfigFilter); + + // Update the filter cache to avoid overwriting user's selection in case the + // GetConfiguration() is called by the user instead of the SelectCameraConfig(). + if (!CameraConfigFilter.Equals(_cachedFilter)) + { + _cachedFilter = + ScriptableObject.CreateInstance(); + _cachedFilter.CopyFrom(CameraConfigFilter); + } + } + } + + private void SelectCameraConfig() + { + if (CameraManager == null) + { + return; + } + + using (var configurations = CameraManager.GetConfigurations(Allocator.Temp)) + { + if (configurations.Length == 0) + { + Debug.LogWarning( + "Unable to choose a custom camera configuration " + + "because none are available."); + return; + } + + int configIndex = 0; + if (OnChooseXRCameraConfiguration != null) + { + configIndex = OnChooseXRCameraConfiguration(configurations.ToList()); + } + + if (configIndex < 0 || configIndex >= configurations.Length) + { + Debug.LogWarning( + "Failed to find a valid config index with " + + "the custom selection function."); + return; + } + + CameraManager.currentConfiguration = configurations[configIndex]; + } + } +#endif // UNITY_ANDROID } } diff --git a/Runtime/Scripts/ARCoreExtensionsCameraConfigFilter.cs b/Runtime/Scripts/ARCoreExtensionsCameraConfigFilter.cs new file mode 100755 index 0000000..7d5a02c --- /dev/null +++ b/Runtime/Scripts/ARCoreExtensionsCameraConfigFilter.cs @@ -0,0 +1,247 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions +{ + using System; + using Google.XR.ARCoreExtensions.Internal; + using UnityEngine; + using UnityEngine.XR.ARSubsystems; + + /// + /// The class is used by the camera manager + /// to derive a list of camera configurations available on the device at runtime. + /// + /// + /// It is possible to select options in such a way that some devices will have no available + /// configurations at runtime. In this case, your app will not run. + /// + /// Beginning with ARCore SDK 1.15.0, some devices support additional camera configs with lower + /// GPU texture resolutions than the device's default GPU texture resolution. See the + /// ARCore supported + /// devices page for an up to date list of devices with this capability. + /// + /// An app may adjust its capabilities at runtime by selecting a wider range of config filters + /// and using to specify a + /// selection function. In that function the app may then adjust its runtime settings and + /// select an appropriate camera configuration. + /// + /// If no callback is registered, ARCore Extensions will use the first + /// in the list of available configurations. + /// + [CreateAssetMenu( + fileName = "ARCoreExtensionsCameraConfigFilter", + menuName = "ARCore Extensions/Camera Config Filter", + order = 2)] + public class ARCoreExtensionsCameraConfigFilter : ScriptableObject + { + /// + /// The camera frame rate filter for the currently selected camera. + /// + [DynamicHelp("GetTargetCameraFramerateInfo")] + [EnumFlags(typeof(CameraConfigTargetFps))] + public CameraConfigTargetFps TargetCameraFramerate = + CameraConfigTargetFps.Target30FPS | CameraConfigTargetFps.Target60FPS; + + /// + /// Allows an app to use or disable a hardware depth sensor if present on the device. + /// + [DynamicHelp("GetDepthSensorUsageInfo")] + [EnumFlags(typeof(CameraConfigDepthSensorUsage))] + public CameraConfigDepthSensorUsage DepthSensorUsage = + CameraConfigDepthSensorUsage.RequireAndUse | CameraConfigDepthSensorUsage.DoNotUse; + + /// + /// Allows an app to use or disable additional cameras to improve tracking. + /// + [DynamicHelp("GetStereoCameraUsageInfo")] + [EnumFlags(typeof(CameraConfigStereoCameraUsage))] + public CameraConfigStereoCameraUsage StereoCameraUsage = + CameraConfigStereoCameraUsage.RequireAndUse | CameraConfigStereoCameraUsage.DoNotUse; + + /// + /// Reflection function used by 'DynamicHelp' for . + /// + /// The help attribute of target camera framerate filter. + public HelpAttribute GetTargetCameraFramerateInfo() + { + if ((TargetCameraFramerate & CameraConfigTargetFps.Target30FPS) == 0) + { + if (TargetCameraFramerate == 0) + { + return new HelpAttribute( + "No options are selected, " + + "there will be no camera configs and this app will fail to run.", + HelpAttribute.HelpMessageType.Error); + } + + return new HelpAttribute( + "Target30FPS is not selected, this may cause no camera config be available " + + "for this filter and the app may not run on all devices.", + HelpAttribute.HelpMessageType.Warning); + } + + return null; + } + + /// + /// Reflection function used by 'DynamicHelp' for . + /// + /// The help attribute of depth sensor usage filter. + public HelpAttribute GetDepthSensorUsageInfo() + { + if ((DepthSensorUsage & CameraConfigDepthSensorUsage.DoNotUse) == 0) + { + if (DepthSensorUsage == 0) + { + return new HelpAttribute( + "No options are selected, " + + "there will be no camera configs and this app will fail to run.", + HelpAttribute.HelpMessageType.Error); + } + + return new HelpAttribute( + "DoNotUse is not selected, this may cause no camera config be available " + + "for this filter and the app may not run on all devices.", + HelpAttribute.HelpMessageType.Warning); + } + + return null; + } + + /// + /// Reflection function used by 'DynamicHelp' for . + /// + /// The help attribute of stereo sensor usage filter. + public HelpAttribute GetStereoCameraUsageInfo() + { + if ((StereoCameraUsage & CameraConfigStereoCameraUsage.DoNotUse) == 0) + { + if (StereoCameraUsage == 0) + { + return new HelpAttribute( + "No options are selected, " + + "there will be no camera configs and this app will fail to run.", + HelpAttribute.HelpMessageType.Error); + } + + return new HelpAttribute( + "DoNotUse is not selected, this may cause no camera config be available " + + "for this filter and the app may not run on all devices.", + HelpAttribute.HelpMessageType.Warning); + } + + return null; + } + + /// + /// Unity's OnValidate. + /// + public void OnValidate() + { + if ((TargetCameraFramerate & CameraConfigTargetFps.Target30FPS) == 0) + { + if (TargetCameraFramerate == 0) + { + Debug.LogError( + "No options in Target Camera Framerate are selected, " + + "there will be no camera configs and this app will fail to run."); + } + + Debug.LogWarning("Target30FPS is not selected, this may cause " + + "no camera config be available for this filter and " + + "the app may not run on all devices."); + } + + if ((DepthSensorUsage & CameraConfigDepthSensorUsage.DoNotUse) == 0) + { + if (DepthSensorUsage == 0) + { + Debug.LogError( + "No options in Depth Sensor Usage are selected, " + + "there will be no camera configs and this app will fail to run."); + } + + Debug.LogWarning( + "DoNotUseDepthSensor is not selected, this may cause no camera config be " + + "available for this filter and the app may not run on all devices."); + } + + if ((StereoCameraUsage & CameraConfigStereoCameraUsage.DoNotUse) == 0) + { + if (StereoCameraUsage == 0) + { + Debug.LogError( + "No options in Stereo Camera Usage are selected, " + + "there will be no camera configs and this app will fail to run."); + } + + Debug.LogWarning( + "DoNotUseStereoCamera is not selected, this may cause no camera config be " + + "available for this filter and the app may not run on all devices."); + } + } + + /// + /// ValueType check if two ARCoreExtensionsCameraConfigFilter objects are equal. + /// + /// The other ARCoreExtensionsCameraConfigFilter. + /// True if the two ARCoreExtensionsCameraConfigFilter objects are + /// value-type equal, otherwise false. + public override bool Equals(object other) + { + ARCoreExtensionsCameraConfigFilter otherFilter = + other as ARCoreExtensionsCameraConfigFilter; + if (otherFilter == null) + { + return false; + } + + if (TargetCameraFramerate != otherFilter.TargetCameraFramerate || + StereoCameraUsage != otherFilter.StereoCameraUsage || + DepthSensorUsage != otherFilter.DepthSensorUsage) + { + return false; + } + + return true; + } + + /// + /// Return a hash code for this object. + /// + /// A hash code value. + public override int GetHashCode() + { + return base.GetHashCode(); + } + + /// + /// ValueType copy from another ARCoreExtensionsCameraConfigFilter object into this one. + /// + /// The ARCoreExtensionsCameraConfigFilter to copy from. + public void CopyFrom(ARCoreExtensionsCameraConfigFilter otherFilter) + { + TargetCameraFramerate = otherFilter.TargetCameraFramerate; + DepthSensorUsage = otherFilter.DepthSensorUsage; + StereoCameraUsage = otherFilter.StereoCameraUsage; + } + } +} diff --git a/Runtime/Scripts/ARCoreExtensionsCameraConfigFilter.cs.meta b/Runtime/Scripts/ARCoreExtensionsCameraConfigFilter.cs.meta new file mode 100755 index 0000000..78c9f01 --- /dev/null +++ b/Runtime/Scripts/ARCoreExtensionsCameraConfigFilter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 269129ba34e5b43d5aac34839ce7f646 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/ARCoreRecordingConfig.cs b/Runtime/Scripts/ARCoreRecordingConfig.cs new file mode 100755 index 0000000..1ee31a3 --- /dev/null +++ b/Runtime/Scripts/ARCoreRecordingConfig.cs @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions +{ + using System; + using UnityEngine; + + /// + /// Configuration to record camera and sensor data from an ARCore session. + /// + public class ARCoreRecordingConfig : ScriptableObject + { + /// + /// A full path and filename on the device where the MP4 recording (including video data + /// from the camera and other device sensors) will be saved. If the file already exists it + /// will be overwritten. + /// + public string Mp4DatasetFilepath; + + /// + /// Set to true to cause the recording to stop automatically when the session is + /// paused, or set to false to allow the recording to continue until the session is + /// destroyed or the recording is stopped manually. When set to false and the session + /// is paused, recording of sensor data continues, but the camera feed will be recorded as a + /// black screen until the session is resumed. + /// + public bool AutoStopOnPause = true; + } +} diff --git a/Runtime/Scripts/ARCoreRecordingConfig.cs.meta b/Runtime/Scripts/ARCoreRecordingConfig.cs.meta new file mode 100755 index 0000000..76172cf --- /dev/null +++ b/Runtime/Scripts/ARCoreRecordingConfig.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fd08c467e0dcb4110826db4f97326096 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/ARPlaybackManager.cs b/Runtime/Scripts/ARPlaybackManager.cs new file mode 100755 index 0000000..46b71e1 --- /dev/null +++ b/Runtime/Scripts/ARPlaybackManager.cs @@ -0,0 +1,60 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions +{ + using System; + using Google.XR.ARCoreExtensions.Internal; + using UnityEngine; + + /// + /// Provides access to session playback functionality. + /// + public static class ARPlaybackManager + { + /// + /// The current state of the playback. + /// + /// The current . + public static PlaybackStatus PlaybackStatus + { + get + { + return SessionApi.GetPlaybackStatus( + ARCoreExtensions._instance.currentARCoreSessionHandle); + } + } + + /// + /// Sets the filepath for a dataset to be played back. The ARCore session + /// must be paused when using this method. Resume the session for the + /// change to take effect. + /// The filepath of the dataset. Null if + /// stopping the playback and resuming a live feed. + /// .Success if playback filepath was + /// set without issue. Otherwise, the will indicate the + /// error. + public static PlaybackResult SetPlaybackDataset(string datasetFilepath) + { + return SessionApi.SetPlaybackDataset( + ARCoreExtensions._instance.currentARCoreSessionHandle, datasetFilepath); + } + } +} diff --git a/Runtime/Scripts/ARPlaybackManager.cs.meta b/Runtime/Scripts/ARPlaybackManager.cs.meta new file mode 100755 index 0000000..41dc6a6 --- /dev/null +++ b/Runtime/Scripts/ARPlaybackManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ee9dd780dfd084e199dcd8675ae963ca +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/ARRecordingManager.cs b/Runtime/Scripts/ARRecordingManager.cs new file mode 100755 index 0000000..0349790 --- /dev/null +++ b/Runtime/Scripts/ARRecordingManager.cs @@ -0,0 +1,75 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions +{ + using System; + using Google.XR.ARCoreExtensions.Internal; + using UnityEngine; + + /// + /// Provides access to session recording functionality. + /// + public static class ARRecordingManager + { + /// + /// The current state of the recorder. + /// + /// The current . + public static RecordingStatus RecordingStatus + { + get + { + return SessionApi.GetRecordingStatus( + ARCoreExtensions._instance.currentARCoreSessionHandle); + } + } + + /// + /// Starts a new recording, using the provided to define the + /// location to save the dataset and other options. If a recording is already in progress + /// this call will fail. Check before making this call. When an + /// ARCore session is paused (unless .AutoStopOnPause + /// is enabled), recording may continue. During this time the camera feed will be recorded + /// as a black screen, but sensor data will continue to be captured. + /// + /// containing the path to save the + /// dataset along with other recording options. + /// .OK if the recording is started (or will start + /// on the next Session resume.) Or a if there was an error. + /// + public static RecordingResult StartRecording(ARCoreRecordingConfig config) + { + return SessionApi.StartRecording( + ARCoreExtensions._instance.currentARCoreSessionHandle, config); + } + + /// + /// Stops the current recording. If there is no recording in progress, this method will + /// return .OK. + /// + /// .OK if the recording was stopped successfully, + /// or .ErrorRecordingFailed if there was an error. + public static RecordingResult StopRecording() + { + return SessionApi.StopRecording(ARCoreExtensions._instance.currentARCoreSessionHandle); + } + } +} diff --git a/Runtime/Scripts/ARRecordingManager.cs.meta b/Runtime/Scripts/ARRecordingManager.cs.meta new file mode 100755 index 0000000..50f965b --- /dev/null +++ b/Runtime/Scripts/ARRecordingManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6359bfb6fc9d24ee2bd78491ee3d2fa2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/CameraConfigDepthSensorUsage.cs b/Runtime/Scripts/CameraConfigDepthSensorUsage.cs index 60fa019..389e10a 100755 --- a/Runtime/Scripts/CameraConfigDepthSensorUsage.cs +++ b/Runtime/Scripts/CameraConfigDepthSensorUsage.cs @@ -22,6 +22,7 @@ namespace Google.XR.ARCoreExtensions { using System; using System.Diagnostics.CodeAnalysis; + using UnityEngine; /// /// Type of depth sensor usage for a camera config. @@ -36,14 +37,20 @@ public enum CameraConfigDepthSensorUsage /// and the depth sensor will be used by ARCore. /// Not supported on all devices. /// + [Tooltip("ARCore requires a depth sensor to be present and will use it. " + + "Not supported on all devices.")] RequireAndUse = 0x0001, /// /// Indicates that ARCore will not attempt to use a depth sensor, even if it is present. /// Most commonly used to filter camera configurations when the app requires /// exclusive access to the depth sensor outside of ARCore, for example to - /// support 3D mesh reconstruction. Available on all ARCore supported devices. + /// support 3D mesh reconstruction. Available on all + /// + /// ARCore supported devices. /// + [Tooltip("ARCore will not use the depth sensor, even if it is present. " + + "Available on all supported devices.")] DoNotUse = 0x0002, } } diff --git a/Runtime/Scripts/CameraConfigStereoCameraUsage.cs b/Runtime/Scripts/CameraConfigStereoCameraUsage.cs index ce21b88..8aa565d 100755 --- a/Runtime/Scripts/CameraConfigStereoCameraUsage.cs +++ b/Runtime/Scripts/CameraConfigStereoCameraUsage.cs @@ -22,6 +22,7 @@ namespace Google.XR.ARCoreExtensions { using System; using System.Diagnostics.CodeAnalysis; + using UnityEngine; /// /// Stereo Camera usage options. @@ -35,13 +36,18 @@ public enum CameraConfigStereoCameraUsage /// A stereo camera is present on the device and will be used by ARCore. /// Not available on all ARCore supported devices. /// + [Tooltip("ARCore requires a stereo camera to be present on the device. " + + "Not available on all ARCore supported devices.")] RequireAndUse = 0x0001, /// /// ARCore will not attempt to use a stereo camera, even if one is /// present. - /// Valid on all ARCore supported devices. + /// Valid on all + /// ARCore supported devices. /// + [Tooltip("ARCore will not use the stereo camera, even if it is present. " + + "Available on all supported devices.")] DoNotUse = 0x0002, } } diff --git a/Runtime/Scripts/CameraConfigTargetFps.cs b/Runtime/Scripts/CameraConfigTargetFps.cs new file mode 100755 index 0000000..e59a1c3 --- /dev/null +++ b/Runtime/Scripts/CameraConfigTargetFps.cs @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions +{ + using System; + using UnityEngine; + + /// + /// The camera frame rate filter for the currently selected camera. + /// + [Flags] + public enum CameraConfigTargetFps + { + /// + /// Target 30fps camera capture frame rate. + /// + /// Available on all + /// + /// ARCore supported devices. + /// + [Tooltip("Target 30fps camera capture frame rate. " + + "Available on all ARCore supported devices.")] + Target30FPS = 0x0001, + + /// + /// Target 60fps camera capture frame rate. + /// + /// Increases power consumption and may increase app memory usage. + /// + /// See the + /// ARCore supported devices page for a list of + /// devices that currently support 60fps. + /// + [Tooltip("Target 60fps camera capture frame rate on supported devices.")] + Target60FPS = 0x0002, + } +} diff --git a/Runtime/Scripts/CameraConfigTargetFps.cs.meta b/Runtime/Scripts/CameraConfigTargetFps.cs.meta new file mode 100755 index 0000000..1c1e80c --- /dev/null +++ b/Runtime/Scripts/CameraConfigTargetFps.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7ae5c309331a44f7cb4948f3cd60c803 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Internal/AndroidPermissionsManager.cs b/Runtime/Scripts/Internal/AndroidPermissionsManager.cs index f1c6ae0..a8d106b 100755 --- a/Runtime/Scripts/Internal/AndroidPermissionsManager.cs +++ b/Runtime/Scripts/Internal/AndroidPermissionsManager.cs @@ -73,6 +73,7 @@ public static void RequestPermission(string permissionName, Action onReque if (IsPermissionGranted(permissionName)) { onRequestFinished(true); + return; } if (_permissionRequest != null) diff --git a/Runtime/Scripts/Internal/Helpers/Translators.cs b/Runtime/Scripts/Internal/Helpers/Translators.cs index c366b98..baa14fc 100755 --- a/Runtime/Scripts/Internal/Helpers/Translators.cs +++ b/Runtime/Scripts/Internal/Helpers/Translators.cs @@ -30,7 +30,6 @@ private static readonly Matrix4x4 _unityWorldToGLWorld private static readonly Matrix4x4 _unityWorldToGLWorldInverse = _unityWorldToGLWorld.inverse; - public static CloudAnchorState ToCloudAnchorState(ApiCloudAnchorState state) { switch (state) @@ -114,5 +113,39 @@ public static Pose ToUnityPose(ApiPose apiPose) return new Pose(position, rotation); } + + public static RecordingStatus ToRecordingStatus(this ApiRecordingStatus apiStatus) + { + switch (apiStatus) + { + case ApiRecordingStatus.OK: + return RecordingStatus.OK; + case ApiRecordingStatus.IOError: + return RecordingStatus.IOError; + case ApiRecordingStatus.None: + return RecordingStatus.None; + default: + Debug.LogErrorFormat("Unrecognized ApiRecordingStatus value {0}", apiStatus); + return RecordingStatus.None; + } + } + + public static PlaybackStatus ToPlaybackStatus(this ApiPlaybackStatus apiStatus) + { + switch (apiStatus) + { + case ApiPlaybackStatus.None: + return PlaybackStatus.None; + case ApiPlaybackStatus.OK: + return PlaybackStatus.OK; + case ApiPlaybackStatus.IOError: + return PlaybackStatus.IOError; + case ApiPlaybackStatus.FinishedSuccess: + return PlaybackStatus.FinishedSuccess; + default: + Debug.LogErrorFormat("Unrecognized ApiPlaybackStatus value {0}", apiStatus); + return PlaybackStatus.None; + } + } } } diff --git a/Runtime/Scripts/Internal/PropertyAttributes/EnumFlagsAttribute.cs b/Runtime/Scripts/Internal/PropertyAttributes/EnumFlagsAttribute.cs new file mode 100755 index 0000000..b3449d7 --- /dev/null +++ b/Runtime/Scripts/Internal/PropertyAttributes/EnumFlagsAttribute.cs @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions.Internal +{ + using UnityEngine; + + /// + /// Enum flags attribute to calculate the "everything" option based on the current + /// enum values instead of using "-1" directly for the backward compatibility. + /// + public class EnumFlagsAttribute : PropertyAttribute + { + /// + /// The enum type of the property with . + /// + public System.Type EnumType; + + /// + /// Constructor of EnumFlagsAttribute class. + /// + /// The type of the enum. + public EnumFlagsAttribute(System.Type type) + { + EnumType = type; + } + } +} diff --git a/Runtime/Scripts/Internal/PropertyAttributes/EnumFlagsAttribute.cs.meta b/Runtime/Scripts/Internal/PropertyAttributes/EnumFlagsAttribute.cs.meta new file mode 100755 index 0000000..38d9ba5 --- /dev/null +++ b/Runtime/Scripts/Internal/PropertyAttributes/EnumFlagsAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5291af9d7502942179085b4be97ca17a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Internal/PropertyAttributes/HelpAttribute.cs b/Runtime/Scripts/Internal/PropertyAttributes/HelpAttribute.cs index 681b5ef..7853b92 100755 --- a/Runtime/Scripts/Internal/PropertyAttributes/HelpAttribute.cs +++ b/Runtime/Scripts/Internal/PropertyAttributes/HelpAttribute.cs @@ -44,8 +44,7 @@ public class HelpAttribute : PropertyAttribute public readonly HelpMessageType MessageType = HelpMessageType.None; /// - /// Initializes a new instance of the - /// class. + /// Initializes a new instance of the class. /// /// Help message. /// Message type. diff --git a/Runtime/Scripts/Internal/Types/ApiArStatus.cs b/Runtime/Scripts/Internal/Types/ApiArStatus.cs index aec8f61..a7cdb3e 100755 --- a/Runtime/Scripts/Internal/Types/ApiArStatus.cs +++ b/Runtime/Scripts/Internal/Types/ApiArStatus.cs @@ -44,6 +44,9 @@ internal enum ApiArStatus ErrorDataInvalidFormat = -18, ErrorDatatUnsupportedVersion = -19, ErrorIllegalState = -20, + ErrorRecordingFailed = -23, + ErrorPlaybackFailed = -24, + ErrorSessionUnsupported = -25, UnavailableArCoreNotInstalled = -100, UnavailableDeviceNotCompatible = -101, UnavailableApkTooOld = -103, diff --git a/Runtime/Scripts/Internal/Types/ApiPlaybackStatus.cs b/Runtime/Scripts/Internal/Types/ApiPlaybackStatus.cs new file mode 100755 index 0000000..8594bba --- /dev/null +++ b/Runtime/Scripts/Internal/Types/ApiPlaybackStatus.cs @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions.Internal +{ + internal enum ApiPlaybackStatus + { + None = 0, + OK = 1, + IOError = 2, + FinishedSuccess = 3, + } +} diff --git a/Runtime/Scripts/Internal/Types/ApiPlaybackStatus.cs.meta b/Runtime/Scripts/Internal/Types/ApiPlaybackStatus.cs.meta new file mode 100755 index 0000000..d5db7a8 --- /dev/null +++ b/Runtime/Scripts/Internal/Types/ApiPlaybackStatus.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 59802b604a80d4b0eb035938a9e1e831 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Internal/Types/ApiRecordingStatus.cs b/Runtime/Scripts/Internal/Types/ApiRecordingStatus.cs new file mode 100755 index 0000000..2eb2fdd --- /dev/null +++ b/Runtime/Scripts/Internal/Types/ApiRecordingStatus.cs @@ -0,0 +1,29 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions.Internal +{ + internal enum ApiRecordingStatus + { + None = 0, + OK = 1, + IOError = 2, + } +} diff --git a/Runtime/Scripts/Internal/Types/ApiRecordingStatus.cs.meta b/Runtime/Scripts/Internal/Types/ApiRecordingStatus.cs.meta new file mode 100755 index 0000000..6442034 --- /dev/null +++ b/Runtime/Scripts/Internal/Types/ApiRecordingStatus.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e59513c7c58f642b7ade84b912ac2dbc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Internal/Wrappers/CameraConfigFilterApi.cs b/Runtime/Scripts/Internal/Wrappers/CameraConfigFilterApi.cs new file mode 100755 index 0000000..f3254a2 --- /dev/null +++ b/Runtime/Scripts/Internal/Wrappers/CameraConfigFilterApi.cs @@ -0,0 +1,64 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions.Internal +{ + using System; + +#if UNITY_IOS && !UNITY_EDITOR + using AndroidImport = Google.XR.ARCoreExtensions.Internal.DllImportNoop; +#else + using AndroidImport = System.Runtime.InteropServices.DllImportAttribute; +#endif + + internal class CameraConfigFilterApi + { + public static void UpdateFilter(IntPtr sessionHandle, IntPtr filterHandle, + ARCoreExtensionsCameraConfigFilter extensionsFilter) + { + if (extensionsFilter != null) + { + ExternApi.ArCameraConfigFilter_setTargetFps( + sessionHandle, filterHandle, (int)extensionsFilter.TargetCameraFramerate); + ExternApi.ArCameraConfigFilter_setDepthSensorUsage( + sessionHandle, filterHandle, (int)extensionsFilter.DepthSensorUsage); + ExternApi.ArCameraConfigFilter_setStereoCameraUsage( + sessionHandle, filterHandle, (int)extensionsFilter.StereoCameraUsage); + } + } + + private struct ExternApi + { +#pragma warning disable 626 + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern void ArCameraConfigFilter_setTargetFps(IntPtr sessionHandle, + IntPtr cameraConfigFilterHandle, int fpsFilter); + + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern void ArCameraConfigFilter_setDepthSensorUsage(IntPtr sessionHandle, + IntPtr cameraConfigFilterHandle, int depthFilter); + + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern void ArCameraConfigFilter_setStereoCameraUsage( + IntPtr sessionHandle, IntPtr cameraConfigFilterHandle, int stereoFilter); +#pragma warning restore 626 + } + } +} diff --git a/Runtime/Scripts/Internal/Wrappers/CameraConfigFilterApi.cs.meta b/Runtime/Scripts/Internal/Wrappers/CameraConfigFilterApi.cs.meta new file mode 100755 index 0000000..e65f4d1 --- /dev/null +++ b/Runtime/Scripts/Internal/Wrappers/CameraConfigFilterApi.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 718b53833789941e888914f244e4fd51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Internal/Wrappers/RecordingConfigApi.cs b/Runtime/Scripts/Internal/Wrappers/RecordingConfigApi.cs new file mode 100755 index 0000000..f951b73 --- /dev/null +++ b/Runtime/Scripts/Internal/Wrappers/RecordingConfigApi.cs @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions.Internal +{ + using System; + +#if UNITY_IOS && ARCORE_EXTENSIONS_IOS_SUPPORT + using AndroidImport = Google.XR.ARCoreExtensions.Internal.DllImportNoop; +#else + using AndroidImport = System.Runtime.InteropServices.DllImportAttribute; +#endif + + internal class RecordingConfigApi + { + public static IntPtr Create(IntPtr sessionHandle, ARCoreRecordingConfig config) + { + IntPtr configHandle = IntPtr.Zero; + ExternApi.ArRecordingConfig_create(sessionHandle, ref configHandle); + + if (config != null) + { + ExternApi.ArRecordingConfig_setMp4DatasetFilePath( + sessionHandle, + configHandle, + config.Mp4DatasetFilepath); + ExternApi.ArRecordingConfig_setAutoStopOnPause( + sessionHandle, + configHandle, + config.AutoStopOnPause ? 1 : 0); + } + + return configHandle; + } + + public static void Destroy(IntPtr recordingConfigHandle) + { + ExternApi.ArRecordingConfig_destroy(recordingConfigHandle); + } + + private struct ExternApi + { +#pragma warning disable 626 + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern void ArRecordingConfig_create( + IntPtr session, ref IntPtr configHandle); + + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern void ArRecordingConfig_destroy( + IntPtr configHandle); + + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern void ArRecordingConfig_setMp4DatasetFilePath( + IntPtr session, IntPtr configHandle, String datasetPath); + + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern void ArRecordingConfig_setAutoStopOnPause( + IntPtr session, IntPtr configHandle, int configEnabled); +#pragma warning restore 626 + } + } +} diff --git a/Runtime/Scripts/Internal/Wrappers/RecordingConfigApi.cs.meta b/Runtime/Scripts/Internal/Wrappers/RecordingConfigApi.cs.meta new file mode 100755 index 0000000..493a4bd --- /dev/null +++ b/Runtime/Scripts/Internal/Wrappers/RecordingConfigApi.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ce5dc462bba94a0193597fd64a7cca5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/Internal/Wrappers/SessionApi.cs b/Runtime/Scripts/Internal/Wrappers/SessionApi.cs index 26bc7a0..fce51cf 100755 --- a/Runtime/Scripts/Internal/Wrappers/SessionApi.cs +++ b/Runtime/Scripts/Internal/Wrappers/SessionApi.cs @@ -126,6 +126,96 @@ public static FeatureMapQuality EstimateFeatureMapQualityForHosting( return (FeatureMapQuality)featureMapQuality; } + public static RecordingStatus GetRecordingStatus(IntPtr sessionHandle) + { + ApiRecordingStatus apiStatus = ApiRecordingStatus.None; + ExternApi.ArSession_getRecordingStatus(sessionHandle, ref apiStatus); + return Translators.ToRecordingStatus(apiStatus); + } + + public static RecordingResult StartRecording(IntPtr sessionHandle, + ARCoreRecordingConfig config) + { + IntPtr recordingConfigHandle = RecordingConfigApi.Create(sessionHandle, config); + + ApiArStatus status = ExternApi.ArSession_startRecording( + sessionHandle, recordingConfigHandle); + + RecordingConfigApi.Destroy(recordingConfigHandle); + + // Only specific ArStatus responses are expected. + switch (status) + { + case ApiArStatus.Success: + return RecordingResult.OK; + case ApiArStatus.ErrorIllegalState: + return RecordingResult.ErrorIllegalState; + case ApiArStatus.ErrorInvalidArgument: + return RecordingResult.ErrorInvalidArgument; + case ApiArStatus.ErrorRecordingFailed: + return RecordingResult.ErrorRecordingFailed; + default: + Debug.LogErrorFormat("Attempt to start a recording failed with unexpected " + + "status: {0}", status); + break; + } + + return RecordingResult.ErrorRecordingFailed; + } + + public static RecordingResult StopRecording(IntPtr sessionHandle) + { + ApiArStatus status = ExternApi.ArSession_stopRecording(sessionHandle); + + // Only specific ArStatus responses are expected. + switch (status) + { + case ApiArStatus.Success: + return RecordingResult.OK; + case ApiArStatus.ErrorRecordingFailed: + return RecordingResult.ErrorRecordingFailed; + default: + Debug.LogErrorFormat("Attempt to stop recording failed with unexpected " + + "status: {0}", status); + break; + } + + return RecordingResult.ErrorRecordingFailed; + } + + public static PlaybackStatus GetPlaybackStatus(IntPtr sessionHandle) + { + ApiPlaybackStatus apiStatus = ApiPlaybackStatus.None; + ExternApi.ArSession_getPlaybackStatus(sessionHandle, ref apiStatus); + return apiStatus.ToPlaybackStatus(); + } + + public static PlaybackResult SetPlaybackDataset(IntPtr sessionHandle, + string datasetFilepath) + { + ApiArStatus status = + ExternApi.ArSession_setPlaybackDataset(sessionHandle, datasetFilepath); + + // Only specific ArStatus responses are expected. + switch (status) + { + case ApiArStatus.Success: + return PlaybackResult.OK; + case ApiArStatus.ErrorSessionNotPaused: + return PlaybackResult.ErrorSessionNotPaused; + case ApiArStatus.ErrorSessionUnsupported: + return PlaybackResult.ErrorSessionUnsupported; + case ApiArStatus.ErrorPlaybackFailed: + return PlaybackResult.ErrorPlaybackFailed; + default: + Debug.LogErrorFormat("Attempt to playback recording failed with unexpected " + + "status: {0}", status); + break; + } + + return PlaybackResult.ErrorPlaybackFailed; + } + [SuppressMessage("UnityRules.UnityStyleRules", "US1113:MethodsMustBeUpperCamelCase", Justification = "External call.")] private struct ExternApi @@ -194,6 +284,26 @@ public static extern void ArConfig_getCloudAnchorMode( IntPtr sessionHandle, IntPtr configHandle, ref ApiCloudAnchorMode mode); + + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern void ArSession_getRecordingStatus( + IntPtr sessionHandle, ref ApiRecordingStatus recordingStatus); + + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern ApiArStatus ArSession_startRecording( + IntPtr sessionHandle, IntPtr recordingConfigHandle); + + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern ApiArStatus ArSession_stopRecording( + IntPtr sessionHandle); + + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern void ArSession_getPlaybackStatus( + IntPtr sessionHandle, ref ApiPlaybackStatus playbackStatus); + + [AndroidImport(ApiConstants.ARCoreNativeApi)] + public static extern ApiArStatus ArSession_setPlaybackDataset( + IntPtr sessionHandle, string datasetFilepath); #pragma warning restore 626 } } diff --git a/Runtime/Scripts/PlaybackResult.cs b/Runtime/Scripts/PlaybackResult.cs new file mode 100755 index 0000000..fd0218d --- /dev/null +++ b/Runtime/Scripts/PlaybackResult.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions +{ + /// + /// Results from attempting to set playback dataset filepath. + /// + public enum PlaybackResult + { + /// + /// The request completed successfully. + /// + OK, + + /// + /// The session was not paused when setting the playback dataset. + /// + ErrorSessionNotPaused, + + /// + /// Operation is unsupported with the current session. + /// + ErrorSessionUnsupported, + + /// + /// Playback failed. + /// + ErrorPlaybackFailed, + } +} diff --git a/Runtime/Scripts/PlaybackResult.cs.meta b/Runtime/Scripts/PlaybackResult.cs.meta new file mode 100755 index 0000000..72c60e9 --- /dev/null +++ b/Runtime/Scripts/PlaybackResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dff2733a670e44ef6bf1eee47352613d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/PlaybackStatus.cs b/Runtime/Scripts/PlaybackStatus.cs new file mode 100755 index 0000000..0003b7f --- /dev/null +++ b/Runtime/Scripts/PlaybackStatus.cs @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions +{ + /// + /// Describes the current playback status. + /// + public enum PlaybackStatus + { + /// + /// The session is not playing back a dataset. + /// + None, + + /// + /// Playback is in process without issues. + /// + OK, + + /// + /// Playback has stopped due to an error. + /// + IOError, + + /// + /// Playback has finished successfully. The session is waiting on the final + /// frame of the dataset. To resume a live camera feed or play another + /// dataset, pause the session, call + /// .SetPlaybackDataset(), and resume the + /// session. + /// + FinishedSuccess, + } +} diff --git a/Runtime/Scripts/PlaybackStatus.cs.meta b/Runtime/Scripts/PlaybackStatus.cs.meta new file mode 100755 index 0000000..a76d902 --- /dev/null +++ b/Runtime/Scripts/PlaybackStatus.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 434863536485a42fd91370b8836e627b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/RecordingResult.cs b/Runtime/Scripts/RecordingResult.cs new file mode 100755 index 0000000..774b357 --- /dev/null +++ b/Runtime/Scripts/RecordingResult.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions +{ + /// + /// Results from recording methods. + /// + public enum RecordingResult + { + /// + /// The request completed successfully. + /// + OK, + + /// + /// The was null or invalid. + /// + ErrorInvalidArgument, + + /// + /// IO or other general failure. + /// + ErrorRecordingFailed, + + /// + /// A recording is already in progress. + /// + ErrorIllegalState, + } +} diff --git a/Runtime/Scripts/RecordingResult.cs.meta b/Runtime/Scripts/RecordingResult.cs.meta new file mode 100755 index 0000000..6a76082 --- /dev/null +++ b/Runtime/Scripts/RecordingResult.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0107b4f9c2b114edebd3acebfcf1cd78 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/RecordingStatus.cs b/Runtime/Scripts/RecordingStatus.cs new file mode 100755 index 0000000..2be42fc --- /dev/null +++ b/Runtime/Scripts/RecordingStatus.cs @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------- +// +// +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// +//----------------------------------------------------------------------- + +namespace Google.XR.ARCoreExtensions +{ + /// + /// Describes the current recording status. + /// + public enum RecordingStatus + { + /// + /// The recorder is not recording. + /// + None, + + /// + /// The recorder is recording normally. + /// + OK, + + /// + /// There was an IO error while recording. + /// + IOError, + } +} diff --git a/Runtime/Scripts/RecordingStatus.cs.meta b/Runtime/Scripts/RecordingStatus.cs.meta new file mode 100755 index 0000000..2dd1177 --- /dev/null +++ b/Runtime/Scripts/RecordingStatus.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 24c04e485230f4b18bbad47e16f2e179 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/VersionInfo.cs b/Runtime/Scripts/VersionInfo.cs index 4ae47e2..389e422 100755 --- a/Runtime/Scripts/VersionInfo.cs +++ b/Runtime/Scripts/VersionInfo.cs @@ -28,6 +28,6 @@ public class VersionInfo /// /// The current ARCore Extensions package version. /// - public static readonly string Version = "1.21.0"; + public static readonly string Version = "1.22.0"; } } diff --git a/Samples~/CloudAnchors/Scenes/CloudAnchors.unity b/Samples~/CloudAnchors/Scenes/CloudAnchors.unity index 959064a..b7cb196 100644 --- a/Samples~/CloudAnchors/Scenes/CloudAnchors.unity +++ b/Samples~/CloudAnchors/Scenes/CloudAnchors.unity @@ -3049,6 +3049,7 @@ MonoBehaviour: CameraManager: {fileID: 67528616} ARCoreExtensionsConfig: {fileID: 11400000, guid: b2397e3a99a724c389c100c6bbc2449d, type: 2} + CameraConfigFilter: {fileID: 0} --- !u!1 &1650823692 GameObject: m_ObjectHideFlags: 0 diff --git a/Samples~/PersistentCloudAnchors/Scenes/PersistentCloudAnchors.unity b/Samples~/PersistentCloudAnchors/Scenes/PersistentCloudAnchors.unity index 3d96948..692c9a8 100644 --- a/Samples~/PersistentCloudAnchors/Scenes/PersistentCloudAnchors.unity +++ b/Samples~/PersistentCloudAnchors/Scenes/PersistentCloudAnchors.unity @@ -3443,6 +3443,7 @@ MonoBehaviour: CameraManager: {fileID: 979260357} ARCoreExtensionsConfig: {fileID: 11400000, guid: 7955d6cb6cc1e4e29a16edf098cb0560, type: 2} + CameraConfigFilter: {fileID: 0} --- !u!4 &1113516780 Transform: m_ObjectHideFlags: 0 diff --git a/package.json b/package.json index 2cac3f7..66ac1fe 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.google.ar.core.arfoundation.extensions", "displayName": "ARCore Extensions", - "version": "1.21.0-preview", + "version": "1.22.0", "unity": "2019.4", "description": "Google ARCore Extensions for AR Foundation. This package provides access to ARCore features not covered by AR Foundation's cross platform API.", "author": @@ -10,8 +10,8 @@ }, "dependencies": { - "com.unity.xr.arfoundation": "4.1.0-preview.5", - "com.unity.xr.arcore": "4.1.0-preview.5" + "com.unity.xr.arfoundation": "4.1.0-preview.10", + "com.unity.xr.arcore": "4.1.0-preview.10" }, "samples": [ {