Example #1
0
    // Token: 0x060000D5 RID: 213 RVA: 0x0000990C File Offset: 0x00007B0C
    public void SetTextureByIndex(int i, global::UnityEngine.Texture t)
    {
        switch (i)
        {
        case 0:
            this.front = t;
            break;

        case 1:
            this.back = t;
            break;

        case 2:
            this.left = t;
            break;

        case 3:
            this.right = t;
            break;

        case 4:
            this.top = t;
            break;

        case 5:
            this.bottom = t;
            break;
        }
    }
    // Token: 0x0600007B RID: 123 RVA: 0x00005954 File Offset: 0x00003B54
    private void OnPostRender()
    {
        global::SteamVR instance = global::SteamVR.instance;

        global::UnityEngine.Camera component = base.GetComponent <global::UnityEngine.Camera>();
        float num  = this.scale * component.aspect / instance.aspect;
        float num2 = -this.scale;
        float num3 = this.scale;
        float num4 = num;
        float num5 = -num;

        global::UnityEngine.Material blitMaterial = global::SteamVR_Camera.blitMaterial;
        blitMaterial.mainTexture = global::SteamVR_Camera.GetSceneTexture(component.allowHDR);
        global::UnityEngine.GL.PushMatrix();
        global::UnityEngine.GL.LoadOrtho();
        blitMaterial.SetPass(0);
        global::UnityEngine.GL.Begin(7);
        global::UnityEngine.GL.TexCoord2(0f, 0f);
        global::UnityEngine.GL.Vertex3(num2, num4, 0f);
        global::UnityEngine.GL.TexCoord2(1f, 0f);
        global::UnityEngine.GL.Vertex3(num3, num4, 0f);
        global::UnityEngine.GL.TexCoord2(1f, 1f);
        global::UnityEngine.GL.Vertex3(num3, num5, 0f);
        global::UnityEngine.GL.TexCoord2(0f, 1f);
        global::UnityEngine.GL.Vertex3(num2, num5, 0f);
        global::UnityEngine.GL.End();
        global::UnityEngine.GL.PopMatrix();
        global::SteamVR_Overlay instance2 = global::SteamVR_Overlay.instance;
        bool flag = instance2 && instance2.texture && global::SteamVR_GameView.overlayMaterial && this.drawOverlay;

        if (flag)
        {
            global::UnityEngine.Texture texture = instance2.texture;
            global::SteamVR_GameView.overlayMaterial.mainTexture = texture;
            float num6 = 0f;
            float num7 = 1f - (float)global::UnityEngine.Screen.height / (float)texture.height;
            float num8 = (float)global::UnityEngine.Screen.width / (float)texture.width;
            float num9 = 1f;
            global::UnityEngine.GL.PushMatrix();
            global::UnityEngine.GL.LoadOrtho();
            global::SteamVR_GameView.overlayMaterial.SetPass((global::UnityEngine.QualitySettings.activeColorSpace == 1) ? 1 : 0);
            global::UnityEngine.GL.Begin(7);
            global::UnityEngine.GL.TexCoord2(num6, num7);
            global::UnityEngine.GL.Vertex3(-1f, -1f, 0f);
            global::UnityEngine.GL.TexCoord2(num8, num7);
            global::UnityEngine.GL.Vertex3(1f, -1f, 0f);
            global::UnityEngine.GL.TexCoord2(num8, num9);
            global::UnityEngine.GL.Vertex3(1f, 1f, 0f);
            global::UnityEngine.GL.TexCoord2(num6, num9);
            global::UnityEngine.GL.Vertex3(-1f, 1f, 0f);
            global::UnityEngine.GL.End();
            global::UnityEngine.GL.PopMatrix();
        }
    }
Example #3
0
    // Token: 0x060000D7 RID: 215 RVA: 0x000099E4 File Offset: 0x00007BE4
    public static void SetOverride(global::UnityEngine.Texture front = null, global::UnityEngine.Texture back = null, global::UnityEngine.Texture left = null, global::UnityEngine.Texture right = null, global::UnityEngine.Texture top = null, global::UnityEngine.Texture bottom = null)
    {
        global::Valve.VR.CVRCompositor compositor = global::Valve.VR.OpenVR.Compositor;
        bool flag = compositor != null;

        if (flag)
        {
            global::UnityEngine.Texture[] array = new global::UnityEngine.Texture[]
            {
                front,
                back,
                left,
                right,
                top,
                bottom
            };
            global::Valve.VR.Texture_t[] array2 = new global::Valve.VR.Texture_t[6];
            for (int i = 0; i < 6; i++)
            {
                array2[i].handle      = ((array[i] != null) ? array[i].GetNativeTexturePtr() : global::System.IntPtr.Zero);
                array2[i].eType       = global::SteamVR.instance.graphicsAPI;
                array2[i].eColorSpace = global::Valve.VR.EColorSpace.Auto;
            }
            global::Valve.VR.EVRCompositorError evrcompositorError = compositor.SetSkyboxOverride(array2);
            bool flag2 = evrcompositorError > global::Valve.VR.EVRCompositorError.None;
            if (flag2)
            {
                global::UnityEngine.Debug.LogError("Failed to set skybox override with error: " + evrcompositorError.ToString());
                bool flag3 = evrcompositorError == global::Valve.VR.EVRCompositorError.TextureIsOnWrongDevice;
                if (flag3)
                {
                    global::UnityEngine.Debug.Log("Set your graphics driver to use the same video card as the headset is plugged into for Unity.");
                }
                else
                {
                    bool flag4 = evrcompositorError == global::Valve.VR.EVRCompositorError.TextureUsesUnsupportedFormat;
                    if (flag4)
                    {
                        global::UnityEngine.Debug.Log("Ensure skybox textures are not compressed and have no mipmaps.");
                    }
                }
            }
        }
    }