private void UpdateConfiguration(ARCoreSessionConfig config)
        {
            // There is no configuration to set.
            if (config == null)
            {
                return;
            }

            // The configuration has not been updated.
            if (_cachedConfig != null && config.Equals(_cachedConfig) &&
                (config.AugmentedImageDatabase == null ||
                 !config.AugmentedImageDatabase._isDirty) &&
                !ExperimentManager.Instance.IsConfigurationDirty)
            {
                return;
            }

            _cachedConfig = ScriptableObject.CreateInstance <ARCoreSessionConfig>();
            _cachedConfig.CopyFrom(config);

            if (_requiredPermissionNames.Count > 0)
            {
                RequestPermissions();
                return;
            }

            ExternApi.ArPresto_setConfigurationDirty();
        }
示例#2
0
        private void _SetConfiguration(ARCoreSessionConfig config)
        {
            // There is no configuration to set.
            if (config == null)
            {
                return;
            }

            // The configuration has not been updated.
            if (m_CachedConfig != null && config.Equals(m_CachedConfig) &&
                (config.AugmentedImageDatabase == null ||
                 !config.AugmentedImageDatabase.m_IsDirty) &&
                !ExperimentManager.Instance.IsConfigurationDirty)
            {
                return;
            }

            if (InstantPreviewManager.IsProvidingPlatform)
            {
                if (config.PlaneFindingMode == DetectedPlaneFindingMode.Disabled)
                {
                    InstantPreviewManager.LogLimitedSupportMessage("disable 'Plane Finding'");
                    config.PlaneFindingMode = DetectedPlaneFindingMode.Horizontal;
                }

                if (!config.EnableLightEstimation)
                {
                    InstantPreviewManager.LogLimitedSupportMessage("disable 'Light Estimation'");
                    config.EnableLightEstimation = true;
                }

                if (config.CameraFocusMode == CameraFocusMode.Auto)
                {
                    InstantPreviewManager.LogLimitedSupportMessage("enable camera Auto Focus mode");
                    config.CameraFocusMode = CameraFocusMode.Fixed;
                }

                if (config.AugmentedImageDatabase != null)
                {
                    InstantPreviewManager.LogLimitedSupportMessage("enable 'Augmented Images'");
                    config.AugmentedImageDatabase = null;
                }

                if (config.AugmentedFaceMode == AugmentedFaceMode.Mesh)
                {
                    InstantPreviewManager.LogLimitedSupportMessage("enable 'Augmented Faces'");
                    config.AugmentedFaceMode = AugmentedFaceMode.Disabled;
                }
            }

            var prestoConfig = new ApiPrestoConfig(config);

            ExternApi.ArPresto_setConfiguration(ref prestoConfig);
            m_CachedConfig = ScriptableObject.CreateInstance <ARCoreSessionConfig>();
            m_CachedConfig.CopyFrom(config);
        }
示例#3
0
 private void _SetConfiguration(ARCoreSessionConfig config)
 {
     if (config == null)
     {
         return;
     }
     if (m_CachedConfig == null || !config.Equals(m_CachedConfig) ||
         (config.AugmentedImageDatabase != null && config.AugmentedImageDatabase.m_IsDirty) ||
         ExperimentManager.Instance.IsConfigurationDirty)
     {
         var prestoConfig = new ApiPrestoConfig(config);
         ExternApi.ArPresto_setConfiguration(ref prestoConfig);
         m_CachedConfig = ScriptableObject.CreateInstance <ARCoreSessionConfig>();
         m_CachedConfig.CopyFrom(config);
     }
 }
        public void SetConfiguration(ARCoreSessionConfig config)
        {
            if (config == null)
            {
                return;
            }

            if (m_CachedConfig == null || !config.Equals(m_CachedConfig) ||
                ExperimentManager.Instance.IsConfigurationDirty)
            {
                GCHandle handle;
                var      prestoConfig = new ApiPrestoConfig(config, out handle);
                ExternApi.ArPresto_setConfiguration(ref prestoConfig);
                m_CachedConfig = ScriptableObject.CreateInstance <ARCoreSessionConfig>();
                m_CachedConfig.CopyFrom(config);
                handle.Free();
            }
        }
        /// <summary>
        /// Generates a config supported by Instant Preview based on the given SessionConfig object.
        /// </summary>
        /// <param name="config">The base SessionConfig object.</param>
        /// <returns>A SessionConfig object copied from given SessionConfig object but
        /// all limited supported features are disabled.</returns>
        public static ARCoreSessionConfig GenerateInstantPreviewSupportedConfig(
            ARCoreSessionConfig config)
        {
            ARCoreSessionConfig newConfig = ScriptableObject.CreateInstance <ARCoreSessionConfig>();

            if (config == null)
            {
                Debug.LogWarning("Attempted to generate Instant Preview Supported Config from" +
                                 "an empty SessionConfig object.");
            }
            else
            {
                newConfig.CopyFrom(config);
            }

            newConfig.LightEstimationMode    = LightEstimationMode.Disabled;
            newConfig.AugmentedImageDatabase = null;
            newConfig.AugmentedFaceMode      = AugmentedFaceMode.Disabled;
            return(newConfig);
        }
示例#6
0
        private void _UpdateConfiguration(ARCoreSessionConfig config)
        {
            // There is no configuration to set.
            if (config == null)
            {
                return;
            }

            // The configuration has not been updated.
            if (m_CachedConfig != null && config.Equals(m_CachedConfig) &&
                (config.AugmentedImageDatabase == null ||
                 !config.AugmentedImageDatabase.IsDirty) &&
                !ExperimentManager.Instance.IsConfigurationDirty)
            {
                return;
            }

            m_CachedConfig = ScriptableObject.CreateInstance <ARCoreSessionConfig>();
            m_CachedConfig.CopyFrom(config);
            ExternApi.ArPresto_setConfigurationDirty();
        }