Beispiel #1
0
    /*************************************  Unity API ****************************************/
    #region Unity API
    private void Awake()
    {
        instance = this;
        if (this.MonoEyeCamera == null)
        {
            this.MonoEyeCamera = this.GetComponent <Camera>();
        }
        if (this.LeftEyeCamera == null)
        {
            this.LeftEyeCamera = this.gameObject.transform.Find("LeftEye").GetComponent <Camera>();
        }
        if (this.RightEyeCamera == null)
        {
            this.RightEyeCamera = this.gameObject.transform.Find("RightEye").GetComponent <Camera>();
        }
        if (this.BothEyeCamera == null)
        {
            this.BothEyeCamera = this.gameObject.transform.Find("BothEye").GetComponent <Camera>();
        }
        if (this.BothEyeCamera != null)
        {
            this.BothEyeCamera.transform.GetComponent <Pvr_UnitySDKEye>().eyeSide = Eye.BothEye;
        }

        Pvr_UnitySDKManager.eventEnterVRMode += SetEyeTrackingMode;
    }
Beispiel #2
0
    void OnEnable()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            if (instance != this)
            {
                instance = this;
            }
        }
        if (Pvr_UnitySDKRender.Instance.StereoRenderPath == StereoRenderingPathPico.SinglePass)
        {
            Pvr_UnitySDKRender.Instance.StereoRendering.InitEye(BothEyeCamera);
        }

#if !UNITY_EDITOR && UNITY_ANDROID
        foreach (var t in Pvr_UnitySDKEyeOverlay.Instances)
        {
            t.RefreshCamera();
            if (t.overlayType == Pvr_UnitySDKEyeOverlay.OverlayType.Overlay)
            {
                if (t.overlayShape ==
                    Pvr_UnitySDKEyeOverlay.OverlayShape.Cylinder)
                {
                    Debug.Log("DISFT Cylinder OverLay = Enable");
                }
                if (t.overlayShape ==
                    Pvr_UnitySDKEyeOverlay.OverlayShape.Equirect)
                {
                    Debug.Log("DISFT 360 OverLay= Enable");
                }
                if (t.overlayShape ==
                    Pvr_UnitySDKEyeOverlay.OverlayShape.Quad)
                {
                    Debug.Log("DISFT 2D OverLay= Enable");
                }
            }
            if (t.overlayType == Pvr_UnitySDKEyeOverlay.OverlayType.Underlay)
            {
                Debug.Log("DISFT UnderLay= Enable");
            }
        }
#endif
        GfxDeviceAdvanceFrameGLES();
        StartCoroutine("EndOfFrame");

        if (screenFade)
        {
            StartCoroutine(ScreenFade(1, 0));
        }
    }
Beispiel #3
0
 /*************************************  Unity API ****************************************/
 #region Unity API
 private void Awake()
 {
     instance = this;
     if (this.MonoEyeCamera == null)
     {
         this.MonoEyeCamera = this.GetComponent <Camera>();
     }
     if (this.LeftEyeCamera == null)
     {
         this.LeftEyeCamera = this.gameObject.transform.Find("LeftEye").GetComponent <Camera>();
     }
     if (this.RightEyeCamera == null)
     {
         this.RightEyeCamera = this.gameObject.transform.Find("RightEye").GetComponent <Camera>();
     }
 }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        GUI.changed = false;

        GUIStyle firstLevelStyle = new GUIStyle(GUI.skin.label);

        firstLevelStyle.alignment = TextAnchor.UpperLeft;
        firstLevelStyle.fontStyle = FontStyle.Bold;
        firstLevelStyle.fontSize  = 12;
        firstLevelStyle.wordWrap  = true;

        var guiContent = new GUIContent();
        Pvr_UnitySDKEyeManager sdkEyeManager = (Pvr_UnitySDKEyeManager)target;

        guiContent.text           = "Eye Tracking";
        guiContent.tooltip        = "Before calling EyeTracking API, enable this option first(For Neo 2 Eye device ONLY). ";
        sdkEyeManager.EyeTracking = EditorGUILayout.Toggle(guiContent, sdkEyeManager.EyeTracking);
        if (sdkEyeManager.EyeTracking)
        {
            EditorGUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Note:", firstLevelStyle);
            EditorGUILayout.LabelField("EyeTracking is supported only on the Neo2 Eye");
            EditorGUILayout.EndVertical();
        }

        guiContent.text    = "Foveated Rendering";
        guiContent.tooltip = "Helps reducing the power usage and slightly increases performance by sacrificing the quality of the peripheral region. In addition, enable both Eye-Tracking and Foveated Rendering will switch to Dynamic Foveated Rendering automatically.";
        sdkEyeManager.FoveatedRendering = EditorGUILayout.Toggle(guiContent, sdkEyeManager.FoveatedRendering);
        if (sdkEyeManager.FoveatedRendering)
        {
            EditorGUI.indentLevel        = 1;
            sdkEyeManager.FoveationLevel = (EFoveationLevel)EditorGUILayout.EnumPopup("Foveation Level", sdkEyeManager.FoveationLevel);
            EditorGUI.indentLevel        = 0;
        }

        EditorUtility.SetDirty(sdkEyeManager);
        if (GUI.changed)
        {
#if !UNITY_5_2
            UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager
                                                                          .GetActiveScene());
#endif
        }
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        GUI.changed = false;

        GUIStyle firstLevelStyle = new GUIStyle(GUI.skin.label);

        firstLevelStyle.alignment = TextAnchor.UpperLeft;
        firstLevelStyle.fontStyle = FontStyle.Bold;
        firstLevelStyle.fontSize  = 12;
        firstLevelStyle.wordWrap  = true;

        Pvr_UnitySDKEyeManager sdkEyeManager = (Pvr_UnitySDKEyeManager)target;

        sdkEyeManager.EyeTracking = EditorGUILayout.Toggle("Eye Tracking", sdkEyeManager.EyeTracking);
        if (sdkEyeManager.EyeTracking)
        {
            EditorGUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Note:", firstLevelStyle);
            EditorGUILayout.LabelField("EyeTracking is supported only on the Neo2 Eye");
            EditorGUILayout.EndVertical();
        }

        sdkEyeManager.FoveatedRendering = EditorGUILayout.Toggle("Foveated Rendering", sdkEyeManager.FoveatedRendering);
        if (sdkEyeManager.FoveatedRendering)
        {
            EditorGUI.indentLevel        = 1;
            sdkEyeManager.FoveationLevel = (EFoveationLevel)EditorGUILayout.EnumPopup("Foveation Level", sdkEyeManager.FoveationLevel);
            EditorGUI.indentLevel        = 0;
        }
        else
        {
            sdkEyeManager.FoveationLevel = EFoveationLevel.None;
        }

        EditorUtility.SetDirty(sdkEyeManager);
        if (GUI.changed)
        {
#if !UNITY_5_2
            UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager
                                                                          .GetActiveScene());
#endif
        }
    }
    /*************************************  Unity API ****************************************/
    #region Unity API
    private void Awake()
    {
        instance = this;
        if (this.MonoEyeCamera == null)
        {
            this.MonoEyeCamera = this.GetComponent <Camera>();
        }
        if (this.LeftEyeCamera == null)
        {
            this.LeftEyeCamera = this.gameObject.transform.Find("LeftEye").GetComponent <Camera>();
        }
        if (this.RightEyeCamera == null)
        {
            this.RightEyeCamera = this.gameObject.transform.Find("RightEye").GetComponent <Camera>();
        }

        Pvr_UnitySDKManager.eventEnterVRMode += SetEyeTrackingMode;
        SetFFRInfo();
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        GUI.changed = false;

        GUIStyle firstLevelStyle = new GUIStyle(GUI.skin.label);

        firstLevelStyle.alignment = TextAnchor.UpperLeft;
        firstLevelStyle.fontStyle = FontStyle.Bold;
        firstLevelStyle.fontSize  = 12;
        firstLevelStyle.wordWrap  = true;

        Pvr_UnitySDKEyeManager sdkEyeManager = (Pvr_UnitySDKEyeManager)target;

        sdkEyeManager.trackEyes = EditorGUILayout.Toggle("Track Eyes", sdkEyeManager.trackEyes);
        if (sdkEyeManager.trackEyes)
        {
            EditorGUILayout.BeginVertical("box");
            EditorGUILayout.LabelField("Note:", firstLevelStyle);
            EditorGUILayout.LabelField("EyeTracking is supported only on the Neo2 Pro");
            EditorGUILayout.EndVertical();
        }

        eFoveationLevel lastlevel = sdkEyeManager.foveationLevel;
        eFoveationLevel newlevel  = (eFoveationLevel)EditorGUILayout.EnumPopup("Foveation Level", sdkEyeManager.foveationLevel);

        if (lastlevel != newlevel)
        {
            sdkEyeManager.foveationLevel = newlevel;
            switch (sdkEyeManager.foveationLevel)
            {
            case eFoveationLevel.None:
                sdkEyeManager.FoveationGainValue    = Vector2.zero;
                sdkEyeManager.FoveationAreaValue    = 0.0f;
                sdkEyeManager.FoveationMinimumValue = 0.0f;
                break;

            case eFoveationLevel.Low:
                sdkEyeManager.FoveationGainValue    = new Vector2(2.0f, 2.0f);
                sdkEyeManager.FoveationAreaValue    = 0.0f;
                sdkEyeManager.FoveationMinimumValue = 0.125f;
                break;

            case eFoveationLevel.Med:
                sdkEyeManager.FoveationGainValue    = new Vector2(3.0f, 3.0f);
                sdkEyeManager.FoveationAreaValue    = 1.0f;
                sdkEyeManager.FoveationMinimumValue = 0.125f;
                break;

            case eFoveationLevel.High:
                sdkEyeManager.FoveationGainValue    = new Vector2(4.0f, 4.0f);
                sdkEyeManager.FoveationAreaValue    = 2.0f;
                sdkEyeManager.FoveationMinimumValue = 0.125f;
                break;
            }
        }
        sdkEyeManager.FoveationGainValue    = EditorGUILayout.Vector2Field("Foveation Gain Value", sdkEyeManager.FoveationGainValue);
        sdkEyeManager.FoveationAreaValue    = EditorGUILayout.FloatField("Foveation Area Value", sdkEyeManager.FoveationAreaValue);
        sdkEyeManager.FoveationMinimumValue = EditorGUILayout.FloatField("Foveation Minimum Value", sdkEyeManager.FoveationMinimumValue);

        EditorUtility.SetDirty(sdkEyeManager);
        if (GUI.changed)
        {
#if !UNITY_5_2
            UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(UnityEngine.SceneManagement.SceneManager
                                                                          .GetActiveScene());
#endif
        }
    }
Beispiel #8
0
 private void Start()
 {
     player = target.gameObject.GetComponent <PlayerMovement>();
     pvr    = FindObjectOfType <Pvr_UnitySDKEyeManager>();
 }