Example #1
0
    // Start is called before the first frame update
    void Start()
    {
        bool supported = GvrBetaSettings.IsFeatureSupported(GvrBetaFeature.SeeThrough);
        bool enabled   = GvrBetaSettings.IsFeatureEnabled(GvrBetaFeature.SeeThrough);

        if (supported && !enabled)
        {
            GvrBetaFeature[] features = new GvrBetaFeature[] { GvrBetaFeature.SeeThrough };
            GvrBetaSettings.RequestFeatures(features, null);
        }
    }
        private void CycleSeeThroughModes()
        {
            if (!GvrBetaSettings.IsFeatureEnabled(GvrBetaFeature.SeeThrough))
            {
                return;
            }

            GvrBetaSeeThroughCameraMode camMode   = GvrBetaHeadset.CameraMode;
            GvrBetaSeeThroughSceneType  sceneType = GvrBetaSeeThroughSceneType.Augmented;

            switch (camMode)
            {
            case GvrBetaSeeThroughCameraMode.Disabled:
                camMode = GvrBetaSeeThroughCameraMode.RawImage;
                break;

            case GvrBetaSeeThroughCameraMode.RawImage:
                camMode = GvrBetaSeeThroughCameraMode.ToneMap;
                break;

            case GvrBetaSeeThroughCameraMode.ToneMap:
                // When see-through is disabled, use scene type Virtual to restore headpose
                // offset to 0.
                sceneType = GvrBetaSeeThroughSceneType.Virtual;
                camMode   = GvrBetaSeeThroughCameraMode.Disabled;
                break;
            }

            GvrBetaHeadset.SetSeeThroughConfig(camMode, sceneType);

            statusText.text = "Mode: " + camMode;

            bool seethruEnabled = camMode != GvrBetaSeeThroughCameraMode.Disabled;

            foreach (var go in hideDuringSeeThrough)
            {
                go.SetActive(!seethruEnabled);
            }
        }
        private void UpdateInfoText()
        {
            if (GvrBetaSettings.IsFeatureEnabled(GvrBetaFeature.SeeThrough))
            {
                // SeeThrough enabled.
                infoText.text = "Press the App button to cycle see-through modes.";
                statusText.gameObject.SetActive(true);
            }
            else
            {
                // SeeThrough not enabled.
                if (GvrBetaSettings.IsFeatureSupported(GvrBetaFeature.SeeThrough))
                {
                    infoText.text = "See-through is not currently enabled. " +
                                    "Enable in Settings > Beta Features.";
                }
                else
                {
                    infoText.text = "See-through is not supported on this system.";
                }

                statusText.gameObject.SetActive(false);
            }
        }