コード例 #1
0
    static void ConfigContinuumMain()
    {
        if (Camera.main)
        {
            Camera.main.transform.localEulerAngles = Vector3.up * 90;

            GeneralizedPerspectiveProjection projection = Camera.main.GetComponent <GeneralizedPerspectiveProjection>();
            if (projection == null)
            {
                projection = Camera.main.gameObject.AddComponent <GeneralizedPerspectiveProjection>();
            }

            projection.SetScreenUL(new Vector3(3.579f, 2.527f, 3.642f));
            projection.SetScreenLL(new Vector3(3.579f, 0.479f, 3.642f));
            projection.SetScreenLR(new Vector3(3.579f, 0.479f, -3.642f));
            projection.SetVirtualCamera(Camera.main);

            StereoscopicCamera stereoCamera = Camera.main.GetComponent <StereoscopicCamera>();
            if (stereoCamera != null)
            {
                DestroyImmediate(stereoCamera);
            }
            projection.SetHeadTracker(GameObject.Find("CAVE2-PlayerController/Head").transform);
        }

        c2sm = GameObject.Find("CAVE2ScreenMask");
        if (c2sm && c2sm.GetComponent <CAVE2ScreenMaskRenderer>())
        {
            c2sm.GetComponent <CAVE2ScreenMaskRenderer>().renderMode = CAVE2ScreenMaskRenderer.RenderMode.None;
        }

        Debug.Log("Configured for Continuum Main Wall");
    }
コード例 #2
0
    static void ConfigContinuum3D()
    {
        if (Camera.main)
        {
            Camera.main.transform.localEulerAngles = Vector3.up * 0;

            GeneralizedPerspectiveProjection projection = Camera.main.GetComponent <GeneralizedPerspectiveProjection>();
            if (projection == null)
            {
                projection = Camera.main.gameObject.AddComponent <GeneralizedPerspectiveProjection>();
            }

            projection.SetScreenUL(new Vector3(-2.051f, 2.627f, 6.043f));
            projection.SetScreenLL(new Vector3(-2.051f, 0.309f, 6.043f));
            projection.SetScreenLR(new Vector3(2.051f, 0.309f, 6.043f));
            projection.SetVirtualCamera(Camera.main);

            StereoscopicCamera stereoCamera = Camera.main.GetComponent <StereoscopicCamera>();
            if (stereoCamera == null)
            {
                stereoCamera = Camera.main.gameObject.AddComponent <StereoscopicCamera>();
            }

            stereoCamera.EnableStereo(true);
            stereoCamera.SetStereoResolution(new Vector2(7680f, 4320f), false);
            stereoCamera.SetStereoInverted(true);

            projection.SetHeadTracker(GameObject.Find("CAVE2-PlayerController/Head").transform);
        }

        c2sm = GameObject.Find("CAVE2ScreenMask");
        if (c2sm && c2sm.GetComponent <CAVE2ScreenMaskRenderer>())
        {
            c2sm.GetComponent <CAVE2ScreenMaskRenderer>().renderMode = CAVE2ScreenMaskRenderer.RenderMode.None;
        }

        Debug.Log("Configured for Continuum Main Wall");
    }
コード例 #3
0
    // Use this for initialization
    void Start()
    {
        configPath = Application.dataPath + "/OmicronVR.cfg";

        string[] cmdArgs = Environment.GetCommandLineArgs();
        for (int i = 0; i < cmdArgs.Length; i++)
        {
            if (cmdArgs[i].Equals("-ovrconfig") && i + 1 < cmdArgs.Length)
            {
                configPath = Environment.CurrentDirectory + "/" + cmdArgs[i + 1];
            }
        }


        panel.SetActive(showUI);

        // Read from config (if it exists, else create on quit)
        try
        {
            StreamReader reader = new StreamReader(configPath);
            config = JsonUtility.FromJson <OmicronVRDisplayManagerConfig>(reader.ReadToEnd());
            projection.SetScreenUL(config.screenUL);
            projection.SetScreenLL(config.screenLL);
            projection.SetScreenLR(config.screenLR);

            stereoScript.SetScreenScale(config.screenScale);
            stereoScript.SetScreenOffset(config.screenOffset);

            stereoScript.SetStereoInverted(config.stereoInverted);
            stereoScript.SetStereoMode(config.stereoMode);
            stereoScript.SetStereoResolution(config.stereoResolution);
            stereoScript.SetEyeSeparation(config.eyeSeparation);
        }
        catch (Exception e)
        {
            Debug.LogWarning(e);
            config = new OmicronVRDisplayManagerConfig();
        }

        // Set callbacks for Canvas Objects
        screenUL_x.onEndEdit.AddListener(delegate { projection.UpdateScreenUL_x(screenUL_x.text); });
        screenUL_y.onEndEdit.AddListener(delegate { projection.UpdateScreenUL_y(screenUL_y.text); });
        screenUL_z.onEndEdit.AddListener(delegate { projection.UpdateScreenUL_z(screenUL_z.text); });

        screenLL_x.onEndEdit.AddListener(delegate { projection.UpdateScreenLL_x(screenLL_x.text); });
        screenLL_y.onEndEdit.AddListener(delegate { projection.UpdateScreenLL_y(screenLL_y.text); });
        screenLL_z.onEndEdit.AddListener(delegate { projection.UpdateScreenLL_z(screenLL_z.text); });

        screenLR_x.onEndEdit.AddListener(delegate { projection.UpdateScreenLR_x(screenLR_x.text); });
        screenLR_y.onEndEdit.AddListener(delegate { projection.UpdateScreenLR_y(screenLR_y.text); });
        screenLR_z.onEndEdit.AddListener(delegate { projection.UpdateScreenLR_z(screenLR_z.text); });

        screenOffset_x.onEndEdit.AddListener(delegate { stereoScript.UpdateScreenOffset_x(screenOffset_x.text); });
        screenOffset_y.onEndEdit.AddListener(delegate { stereoScript.UpdateScreenOffset_y(screenOffset_y.text); });
        screenScale_x.onEndEdit.AddListener(delegate { stereoScript.UpdateScreenScale_x(screenScale_x.text); });
        screenScale_y.onEndEdit.AddListener(delegate { stereoScript.UpdateScreenScale_y(screenScale_y.text); });

        stereoModeMenu.onValueChanged.AddListener(delegate { stereoScript.SetStereoMode(stereoModeMenu.value); });
        invertStereo.onClick.AddListener(delegate { stereoScript.InvertStereo(); });
        invertStereo.onClick.AddListener(delegate { CheckState(); });

        resolution_x.onEndEdit.AddListener(delegate { stereoScript.UpdateStereoResolution_x(resolution_x.text); });
        resolution_y.onEndEdit.AddListener(delegate { stereoScript.UpdateStereoResolution_y(resolution_y.text); });

        useCurrentResolution.onClick.AddListener(delegate { stereoScript.SetStereoResolution(new Vector2(Screen.width, Screen.height)); });

        eyeSeparation.onEndEdit.AddListener(delegate { stereoScript.UpdateEyeSeparation(eyeSeparation.text); });

        // Set initial UI values
        screenUL        = projection.GetScreenUL();
        screenUL_x.text = screenUL.x.ToString();
        screenUL_y.text = screenUL.y.ToString();
        screenUL_z.text = screenUL.z.ToString();

        screenLL        = projection.GetScreenLL();
        screenLL_x.text = screenLL.x.ToString();
        screenLL_y.text = screenLL.y.ToString();
        screenLL_z.text = screenLL.z.ToString();

        screenLR        = projection.GetScreenLR();
        screenLR_x.text = screenLR.x.ToString();
        screenLR_y.text = screenLR.y.ToString();
        screenLR_z.text = screenLR.z.ToString();

        screenScale        = stereoScript.GetScreenScale();
        screenScale_x.text = screenScale.x.ToString();
        screenScale_y.text = screenScale.y.ToString();

        screenOffset        = stereoScript.GetScreenOffset();
        screenOffset_x.text = screenOffset.x.ToString();
        screenOffset_y.text = screenOffset.y.ToString();

        stereoResolution  = stereoScript.GetStereoResolution();
        resolution_x.text = stereoResolution.x.ToString();
        resolution_y.text = stereoResolution.y.ToString();

        eyeSeparation.text = stereoScript.GetEyeSeparation().ToString();

        CheckState();
    }