Пример #1
0
    // GUIStereoBox - Values based on pixels in DK1 resolution of W: (1280 / 2) H: 800
    void GUIStereoBox(int X, int Y, int wX, int wY, ref string text, Color color)
    {
        float ploLeft = 0, ploRight = 0;
        float sSX = (float)Screen.width / 1280.0f;

        float sSY = ((float)Screen.height / 800.0f);

        OVRDevice.GetPhysicalLensOffsets(ref ploLeft, ref ploRight);
        int xL       = (int)((float)X * sSX);
        int sSpreadX = (int)((float)StereoSpreadX * sSX);
        int xR       = (Screen.width / 2) + xL + sSpreadX -
                       // required to adjust for physical lens shift
                       (int)(ploLeft * (float)Screen.width / 2);
        int y = (int)((float)Y * sSY);

        GUI.contentColor = color;

        int sWX = (int)((float)wX * sSX);
        int sWY = (int)((float)wY * sSY);

        // Change font size based on screen scale
        if (Screen.height > 800)
        {
            GUI.skin.font = FontReplaceLarge;
        }
        else
        {
            GUI.skin.font = FontReplaceSmall;
        }

        GUI.Box(new Rect(xL, y, sWX, sWY), text);
        GUI.Box(new Rect(xR, y, sWX, sWY), text);
    }
Пример #2
0
    // StereoBox - Values based on pixels in DK1 resolution of W: (1280 / 2) H: 800
    // TODO: Create overloaded function to take normalized float values from 0 - 1 on screen
    public void StereoBox(int X, int Y, int wX, int wY, ref string text, Color color)
    {
        Font prevFont = GUI.skin.font;

        if (Draw3D == true)
        {
            GUI.contentColor = color;

            if (GUI.skin.font != FontReplace)
            {
                GUI.skin.font = FontReplace;
            }

            float sSX = (float)Screen.width / PixelWidth;
            float sSY = (float)Screen.height / PixelHeight;

            int x  = (int)((float)X * sSX * 1.75f);
            int wx = (int)((float)wX * sSY * 1.0f);

            GUI.Box(new Rect(x, Y, wx, wY), text);
        }
        else
        {
            // Deprecate this part of code; we will want to do everything in 3D space
            // on the RIFT (especially when HD versions of the Rift are available)
            float ploLeft = 0, ploRight = 0;
            float sSX = (float)Screen.width / PixelWidth;
            float sSY = (float)Screen.height / PixelHeight;

            OVRDevice.GetPhysicalLensOffsets(ref ploLeft, ref ploRight);

            int xL       = (int)((float)X * sSX);
            int sSpreadX = (int)(StereoSpreadX * sSX);
            int xR       = (Screen.width / 2) + xL + sSpreadX -
                           // required to adjust for physical lens shift
                           (int)(ploLeft * (float)Screen.width / 2);
            int y = (int)((float)Y * sSY);

            GUI.contentColor = color;

            int sWX = (int)((float)wX * sSX);
            int sWY = (int)((float)wY * sSY);

            if (FontReplace != null)
            {
                GUI.skin.font = FontReplace;
            }

            GUI.Box(new Rect(xL, y, sWX, sWY), text);
            GUI.Box(new Rect(xR, y, sWX, sWY), text);
        }

        GUI.skin.font = prevFont;
    }
Пример #3
0
    // Start
    void Start()
    {
        DisplayCrosshair      = false;
        CollisionWithGeometry = false;
        FadeVal = 0.0f;
        MainCam = Camera.main;

        // Initialize screen location of cursor
        XL = Screen.width * 0.25f;
        YL = Screen.height * 0.5f;

        // Get the values for both IPD and lens distortion correction shift
        OVRDevice.GetPhysicalLensOffsets(ref LensOffsetLeft, ref LensOffsetRight);
    }