Exemplo n.º 1
0
    /*************************************  Unity API ****************************************/
    #region Application EVENT

    void Awake()
    {
        if (!VrUtility.IsPicoVR)
        {
            return;
        }

        if (sdk == null)
        {
            sdk = this;
        }
        if (sdk != this)
        {
            Debug.LogWarning("SDK object should be a singleton.");
            enabled = false;
            return;
        }
        string     FPSname = "PicoVR/Head/FPS";
        GameObject FPS     = GameObject.Find(FPSname);

        FPS.SetActive(showFPS);
        InitDevice();
        picoVRProfile = PicoVRConfigProfile.Default.Clone();
        inPicovr      = false;
        newInPicovr   = true;
        eyeFov        = 90.0f;
        headPose      = new PicoVRPose(Matrix4x4.identity);
        //CheckStereoRender();
        AddPrePostRenderStages();
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        GUI.changed = false;

        //GUI style 设置
        GUIStyle firstLevelStyle = new GUIStyle(GUI.skin.label);

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

        //inspector 所在 target
        PicoVRManager manager = (PicoVRManager)target;

        //一级分层标题 1
        GUILayout.Space(10);
        EditorGUILayout.LabelField("ConfigFile Setting", firstLevelStyle);
        GUILayout.Space(10);

        manager.DeviceType = (PicoVRConfigProfile.DeviceTypes)EditorGUILayout.EnumPopup("Choose The Glass   ", manager.DeviceType);

        //一级分层标题 2
        GUILayout.Space(10);
        EditorGUILayout.LabelField("Render Texture Setting", firstLevelStyle);
        GUILayout.Space(10);

        manager.RtAntiAlising = (PicoVRBaseDevice.RenderTextureAntiAliasing)EditorGUILayout.EnumPopup("Render Texture Anti-Aliasing ", manager.RtAntiAlising);
        manager.RtBitDepth    = (PicoVRBaseDevice.RenderTextureDepth)EditorGUILayout.EnumPopup("Render Texture Bit Depth   ", manager.RtBitDepth);
        manager.RtFormat      = (RenderTextureFormat)EditorGUILayout.EnumPopup("Render Texture Format", manager.RtFormat);


        //一级分层标题 1
        GUILayout.Space(10);
        EditorGUILayout.LabelField("Pico Neo Controller Sensor", firstLevelStyle);
        GUILayout.Space(10);
        manager.UseFalconBoxSensor = EditorGUILayout.Toggle("Enable Pico Neo Controller Sensor", manager.UseFalconBoxSensor);
        GUILayout.Space(10);

        //一级分层标题 1
        GUILayout.Space(10);
        EditorGUILayout.LabelField("Show FPS", firstLevelStyle);
        GUILayout.Space(10);
        manager.ShowFPS = EditorGUILayout.Toggle("Show FPS in Scene", manager.ShowFPS);
        GUILayout.Space(10);

        //开启编辑器调试模式
        GUILayout.Space(10);
        EditorGUILayout.LabelField("Editor Debug", firstLevelStyle);
        GUILayout.Space(10);
        manager.IsVREditorDebug = EditorGUILayout.Toggle("Open Editor Debug ", manager.IsVREditorDebug);
        GUILayout.Space(10);

        if (GUI.changed)
        {
            EditorUtility.SetDirty(manager);
        }
    }
Exemplo n.º 3
0
    void OnDestroy()
    {
        if (!VrUtility.IsPicoVR)
        {
            return;
        }

        if (sdk == this)
        {
            sdk = null;
        }
        RenderTexture.active = null;
        Resources.UnloadUnusedAssets();
        System.GC.Collect();
    }