Пример #1
0
        protected override void OnResume()
        {
            Log.Debug(TAG, "OnResume");
            base.OnResume();
            mDisplayRotationManager.RegisterDisplayListener();
            Exception exception = null;

            message = null;
            if (mArSession == null)
            {
                try
                {
                    if (!ArEngineAbilityCheck())
                    {
                        Finish();
                        return;
                    }
                    mArSession = new ARSession(this);
                    mArConfig  = new ARFaceTrackingConfig(mArSession);

                    mArConfig.SetPowerMode(ARConfigBase.PowerMode.PowerSaving);

                    if (isOpenCameraOutside)
                    {
                        mArConfig.SetImageInputMode(ARConfigBase.ImageInputMode.ExternalInputAll);
                    }
                    mArSession.Configure(mArConfig);
                }
                catch (Exception capturedException)
                {
                    exception = capturedException;
                    SetMessageWhenError(capturedException);
                }
                if (message != null)
                {
                    StopArSession(exception);
                    return;
                }
            }
            try
            {
                mArSession.Resume();
            }
            catch (ARCameraNotAvailableException e)
            {
                Toast.MakeText(this, "Camera open failed, please restart the app", ToastLength.Short).Show();
                mArSession = null;
                return;
            }
            mDisplayRotationManager.RegisterDisplayListener();
            SetCamera();
            mFaceRenderManager.SetArSession(mArSession);
            mFaceRenderManager.SetOpenCameraOutsideFlag(isOpenCameraOutside);
            mFaceRenderManager.SetTextureId(textureId);
            glSurfaceView.OnResume();
        }
        protected override void OnResume()
        {
            Log.Debug(TAG, "onResume");
            base.OnResume();
            Exception exception = null;

            message = null;
            if (mArSession == null)
            {
                try
                {
                    if (!ArEngineAbilityCheck())
                    {
                        Finish();
                        return;
                    }
                    mArSession = new ARSession(this);
                    ARBodyTrackingConfig config = new ARBodyTrackingConfig(mArSession);
                    config.EnableItem = ARConfigBase.EnableDepth | ARConfigBase.EnableMask;
                    mArSession.Configure(config);
                    mBodyRenderManager.SetArSession(mArSession);
                }
                catch (Exception capturedException)
                {
                    exception = capturedException;
                    SetMessageWhenError(capturedException);
                }
                if (message != null)
                {
                    Toast.MakeText(this, message, ToastLength.Long).Show();
                    Log.Debug(TAG, "Creating session" + exception.Message);
                    if (mArSession != null)
                    {
                        mArSession.Stop();
                        mArSession = null;
                    }
                    return;
                }
            }
            try
            {
                mArSession.Resume();
            }
            catch (ARCameraNotAvailableException e)
            {
                Toast.MakeText(this, "Camera open failed, please restart the app", ToastLength.Long).Show();
                mArSession = null;
                return;
            }
            mSurfaceView.OnResume();
            mDisplayRotationManager.RegisterDisplayListener();
        }
Пример #3
0
        protected override void OnResume()
        {
            Log.Debug(TAG, "OnResume");
            base.OnResume();
            Exception exception = null;

            message = null;
            if (mArSession == null)
            {
                try
                {
                    if (!ArEngineAbilityCheck())
                    {
                        Finish();
                        return;
                    }
                    mArSession = new ARSession(this);
                    ARHandTrackingConfig config = new ARHandTrackingConfig(mArSession);
                    config.CameraLensFacing = ARConfigBase.CameraLensFacing.Front;
                    config.SetPowerMode(ARConfigBase.PowerMode.UltraPowerSaving);

                    long item = ARConfigBase.EnableDepth;
                    config.EnableItem = item;
                    mArSession.Configure(config);
                    mHandRenderManager.SetArSession(mArSession);
                    Log.Debug(TAG, "Item = " + config.EnableItem);
                }
                catch (Exception capturedException)
                {
                    exception = capturedException;
                    SetMessageWhenError(capturedException);
                }
                if (message != null)
                {
                    StopArSession(exception);
                    return;
                }
            }
            try
            {
                mArSession.Resume();
            }
            catch (ARCameraNotAvailableException e)
            {
                Toast.MakeText(this, "Camera open failed, please restart the app", ToastLength.Long).Show();
                mArSession = null;
                return;
            }
            mDisplayRotationManager.RegisterDisplayListener();
            mSurfaceView.OnResume();
        }
Пример #4
0
        protected override void OnResume()
        {
            Log.Debug(TAG, "OnResume");
            base.OnResume();
            Exception exception = null;

            message = null;
            if (mArSession == null)
            {
                try
                {
                    if (!ArEngineAbilityCheck())
                    {
                        Finish();
                        return;
                    }
                    mArSession = new ARSession(this);
                    ARWorldTrackingConfig config = new ARWorldTrackingConfig(mArSession);
                    config.SetFocusMode(ARConfigBase.FocusMode.AutoFocus);
                    config.SemanticMode = (ARWorldTrackingConfig.SemanticPlane);
                    mArSession.Configure(config);
                    mWorldRenderManager.SetArSession(mArSession);
                }
                catch (Exception capturedException)
                {
                    exception = capturedException;
                    SetMessageWhenError(capturedException);
                }
                if (message != null)
                {
                    StopArSession(exception);
                    return;
                }
            }
            try
            {
                mArSession.Resume();
            }
            catch (ARCameraNotAvailableException e)
            {
                Toast.MakeText(this, "Camera open failed, please restart the app", ToastLength.Long).Show();
                mArSession = null;
                return;
            }
            mDisplayRotationManager.RegisterDisplayListener();
            mSurfaceView.OnResume();
        }