Ejemplo n.º 1
0
    // on Vuforia Started
    void SetupMixedRealityMode()
    {
        this.currentMode = GetMixedRealityMode();
        MixedRealityController.Instance.SetMode(this.currentMode);

        UpdateVisibleObjects();
    }
Ejemplo n.º 2
0
        public void SetMode(MixedRealityController.Mode mode)
        {
            this.ResolveMembers();
            switch (mode)
            {
            case MixedRealityController.Mode.HANDHELD_AR:
                this.SetHandheldAR();
                return;

            case MixedRealityController.Mode.ROTATIONAL_HANDHELD_AR:
                this.SetRotationalHandheldAR();
                return;

            case MixedRealityController.Mode.HANDHELD_VR:
                this.SetHandheldVR();
                return;

            case MixedRealityController.Mode.VIEWER_AR:
                this.SetViewerAR();
                return;

            case MixedRealityController.Mode.ROTATIONAL_VIEWER_AR:
                this.SetRotationalViewerAR();
                return;

            case MixedRealityController.Mode.VIEWER_VR:
                this.SetViewerVR();
                return;

            default:
                return;
            }
        }
Ejemplo n.º 3
0
    // on Vuforia Started
    void SetupMixedRealityMode()
    {
        this.currentMode = GetMixedRealityMode();
        MixedRealityController.Instance.SetMode(this.currentMode);

        this.vrContentManager.EnableVRContent(!this.InAR);
    }
Ejemplo n.º 4
0
    void IFaderNotify.OnFadeOutFinished()
    {
        VLog.Log("cyan", "IFaderNotify.OnFadeOutFinished() called: " + gameObject.name);

        // We need to check if the video background is curently enabled
        // because Vuforia may restart the video background when the App is resumed
        // even if the app was paused in VR mode

        MixedRealityController.Mode mixedRealityMode = GetMixedRealityMode();

        if ((this.currentMode != mixedRealityMode) ||
            (this.InAR != VideoBackgroundManager.Instance.VideoBackgroundEnabled))
        {
            // mixed reality mode to switch to
            this.currentMode = mixedRealityMode;

            // When we transition to VR, we deactivate the Datasets
            // before setting the mixed reality mode.
            // so to reduce CPU usage, as tracking is not needed in this phase
            // (with AutoStopCameraIfNotRequired ON by default, camera/tracker
            //  will be turned off for performance optimization).

            if (this.currentMode == MixedRealityController.Mode.HANDHELD_VR ||
                this.currentMode == MixedRealityController.Mode.VIEWER_VR)
            {
                Debug.Log("Switching to VR: deactivating datasets");
                ActivateDataSets(false);
            }

            // As we are moving back to AR, we re-activate the Datasets,
            // before setting the mixed reality mode.
            // this will ensure that the Tracker and Camera are restarted,
            // in case they were previously stopped when moving to VR
            // before activating the AR mode
            if (this.currentMode == MixedRealityController.Mode.HANDHELD_AR ||
                this.currentMode == MixedRealityController.Mode.VIEWER_AR)
            {
                Debug.Log("Switching to AR: activating datasets");
                ActivateDataSets(true);
            }

            MixedRealityController.Instance.SetMode(this.currentMode);

            this.vrContentManager.EnableVRContent(!this.InAR);

            this.fader.FadeIn();
        }
    }
Ejemplo n.º 5
0
    void Start()
    {
        // At start we assume we are in AR
        mTransitionCursor = 0;

        mBlackMask = FindObjectOfType <BlackMaskBehaviour>();
        SetBlackMaskVisible(false, 0);

        VideoBackgroundManager.Instance.SetVideoBackgroundEnabled(true);

        mCurrentMode = GetMixedRealityMode();
        MixedRealityController.Instance.SetMode(mCurrentMode);

        UpdateVisibleObjects();

        mCurrentTime = Time.realtimeSinceStartup;
    }
Ejemplo n.º 6
0
    // on Vuforia Started
    void SetupMixedRealityMode()
    {
        mCurrentMode = GetMixedRealityMode();
        MixedRealityController.Instance.SetMode(mCurrentMode);

        UpdateVisibleObjects();

        if (!isFullScreenMode)
        {
            // Activate the alignment bar if using stereo views
            //Canvas stereoDivisionCanvas = GetComponent<Canvas>();
            if (StereoViewDivider)
            {
                StereoViewDivider.enabled = true;
            }
        }
    }
Ejemplo n.º 7
0
    void Update()
    {
        float time      = Time.realtimeSinceStartup;
        float deltaTime = Mathf.Clamp01(time - mCurrentTime);

        mCurrentTime = time;

        // We need to check if the video background is curently enabled
        // because Vuforia may restart the video background when the App is resumed
        // even if the app was paused in VR mode
        bool isVideoCurrentlyEnabled = IsVideoBackgroundRenderingEnabled();

        MixedRealityController.Mode mixedRealityMode = GetMixedRealityMode();

        if ((mCurrentMode != mixedRealityMode) || (InAR != isVideoCurrentlyEnabled))
        {
            // mixed reality mode to switch to
            mCurrentMode = mixedRealityMode;

            // When we transition to VR, we deactivate the Datasets
            // before setting the mixed reality mode.
            // so to reduce CPU usage, as tracking is not needed in this phase
            // (with AutoStopCameraIfNotRequired ON by default, camera/tracker
            //  will be turned off for performance optimization).

            if (mCurrentMode == MixedRealityController.Mode.HANDHELD_VR ||
                mCurrentMode == MixedRealityController.Mode.VIEWER_VR)
            {
                Debug.Log("Switching to VR: deactivating datasets");
                ActivateDatasets(false);
            }

            // As we are moving back to AR, we re-activate the Datasets,
            // before setting the mixed reality mode.
            // this will ensure that the Tracker and Camera are restarted,
            // in case they were previously stopped when moving to VR
            // before activating the AR mode
            if (mCurrentMode == MixedRealityController.Mode.HANDHELD_AR ||
                mCurrentMode == MixedRealityController.Mode.VIEWER_AR)
            {
                Debug.Log("Switching to AR: activating datasets");
                ActivateDatasets(true);
            }

            MixedRealityController.Instance.SetMode(mCurrentMode);
            UpdateVisibleObjects();
        }

        if (mPlaying)
        {
            float fadeFactor = 0;
            if (mTransitionCursor < 0.33f)
            {
                // fade to full black in first part of transition
                fadeFactor = Mathf.SmoothStep(0, 1, mTransitionCursor / 0.33f);
            }
            else if (mTransitionCursor < 0.66f)
            {
                // between 33% and 66% we stay in full black
                fadeFactor = 1;
            }
            else // > 0.66
            {
                // between 66% and 100% we fade out
                fadeFactor = Mathf.SmoothStep(1, 0, (mTransitionCursor - 0.66f) / 0.33f);
            }
            SetBlackMaskVisible(true, fadeFactor);

            float delta = (mBackward ? -1 : 1) * deltaTime / transitionDuration;
            mTransitionCursor += delta;

            if (mTransitionCursor <= 0 || mTransitionCursor >= 1)
            {
                // Done: stop animated transition
                mTransitionCursor = Mathf.Clamp01(mTransitionCursor);
                mPlaying          = false;
                SetBlackMaskVisible(false, 0);
            }
        }
    }
 void UpdateMixedRealityController()
 {
     MixedRealityController.Mode mixedRealityMode = GetMixedRealityMode();
     mCurrentMode = mixedRealityMode;
     Init();
 }
Ejemplo n.º 9
0
 public void SwtichToHandheld()
 {
     //controller.SetMode(MixedRealityController.Mode.HANDHELD_AR);
     ARMode = MixedRealityController.Mode.HANDHELD_AR;
     LoadARScene();
 }
Ejemplo n.º 10
0
 public void SwitchToVR()
 {
     //controller.SetMode(MixedRealityController.Mode.VIEWER_AR);
     ARMode = MixedRealityController.Mode.VIEWER_AR;
     LoadARScene();
 }