Example #1
0
    // Token: 0x060000B7 RID: 183 RVA: 0x000083AC File Offset: 0x000065AC
    private void RenderEye(global::SteamVR vr, global::Valve.VR.EVREye eye)
    {
        global::SteamVR_Render.eye = eye;
        bool flag = this.cameraMask != null;

        if (flag)
        {
            this.cameraMask.Set(vr, eye);
        }
        foreach (global::SteamVR_Camera steamVR_Camera in this.cameras)
        {
            steamVR_Camera.transform.localPosition = vr.eyes[(int)eye].pos;
            steamVR_Camera.transform.localRotation = vr.eyes[(int)eye].rot;
            this.cameraMask.transform.position     = steamVR_Camera.transform.position;
            global::UnityEngine.Camera component = steamVR_Camera.GetComponent <global::UnityEngine.Camera>();
            component.targetTexture = global::SteamVR_Camera.GetSceneTexture(component.allowHDR);
            int  cullingMask = component.cullingMask;
            bool flag2       = eye == global::Valve.VR.EVREye.Eye_Left;
            if (flag2)
            {
                component.cullingMask &= ~this.rightMask;
                component.cullingMask |= this.leftMask;
            }
            else
            {
                component.cullingMask &= ~this.leftMask;
                component.cullingMask |= this.rightMask;
            }
            component.Render();
            component.cullingMask = cullingMask;
        }
    }
Example #2
0
    // Token: 0x060000B6 RID: 182 RVA: 0x0000839C File Offset: 0x0000659C
    private global::System.Collections.IEnumerator RenderLoop()
    {
        for (;;)
        {
            yield return(new global::UnityEngine.WaitForEndOfFrame());

            bool pauseRendering = global::SteamVR_Render.pauseRendering;
            if (!pauseRendering)
            {
                global::Valve.VR.CVRCompositor compositor = global::Valve.VR.OpenVR.Compositor;
                bool flag = compositor != null;
                if (flag)
                {
                    bool flag2 = !compositor.CanRenderScene();
                    if (flag2)
                    {
                        continue;
                    }
                    compositor.SetTrackingSpace(this.trackingSpace);
                    global::SteamVR_Utils.QueueEventOnRenderThread(201510020);
                    global::SteamVR.Unity.EventWriteString("[UnityMain] GetNativeTexturePtr - Begin");
                    global::SteamVR_Camera.GetSceneTexture(this.cameras[0].GetComponent <global::UnityEngine.Camera>().allowHDR).GetNativeTexturePtr();
                    global::SteamVR.Unity.EventWriteString("[UnityMain] GetNativeTexturePtr - End");
                    compositor.GetLastPoses(this.poses, this.gamePoses);
                    global::SteamVR_Utils.Event.Send("new_poses", new object[]
                    {
                        this.poses
                    });
                    global::SteamVR_Utils.Event.Send("new_poses_applied", global::System.Array.Empty <object>());
                }
                global::SteamVR_Overlay overlay = global::SteamVR_Overlay.instance;
                bool flag3 = overlay != null;
                if (flag3)
                {
                    overlay.UpdateOverlay();
                }
                this.RenderExternalCamera();
                global::SteamVR vr = global::SteamVR.instance;
                this.RenderEye(vr, global::Valve.VR.EVREye.Eye_Left);
                this.RenderEye(vr, global::Valve.VR.EVREye.Eye_Right);
                foreach (global::SteamVR_Camera c in this.cameras)
                {
                    c.transform.localPosition = global::UnityEngine.Vector3.zero;
                    c.transform.localRotation = global::UnityEngine.Quaternion.identity;
                    c = null;
                }
                global::SteamVR_Camera[] array = null;
                bool flag4 = this.cameraMask != null;
                if (flag4)
                {
                    this.cameraMask.Clear();
                }
                compositor = null;
                overlay    = null;
                vr         = null;
            }
        }
        yield break;
    }
Example #3
0
    // Token: 0x0600004C RID: 76 RVA: 0x000039C4 File Offset: 0x00001BC4
    public void Set(global::SteamVR vr, global::Valve.VR.EVREye eye)
    {
        bool flag = global::SteamVR_CameraMask.hiddenAreaMeshes[(int)eye] == null;

        if (flag)
        {
            global::SteamVR_CameraMask.hiddenAreaMeshes[(int)eye] = global::SteamVR_Utils.CreateHiddenAreaMesh(vr.hmd.GetHiddenAreaMesh(eye), vr.textureBounds[(int)eye]);
        }
        this.meshFilter.mesh = global::SteamVR_CameraMask.hiddenAreaMeshes[(int)eye];
    }
    // 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 #5
0
    // Token: 0x0600003B RID: 59 RVA: 0x00002CB8 File Offset: 0x00000EB8
    public static global::UnityEngine.RenderTexture GetSceneTexture(bool hdr)
    {
        global::SteamVR instance = global::SteamVR.instance;
        bool            flag     = instance == null;

        global::UnityEngine.RenderTexture result;
        if (flag)
        {
            result = null;
        }
        else
        {
            int num  = (int)(instance.sceneWidth * global::SteamVR_Camera.sceneResolutionScale);
            int num2 = (int)(instance.sceneHeight * global::SteamVR_Camera.sceneResolutionScale);
            int num3 = (global::UnityEngine.QualitySettings.antiAliasing == 0) ? 1 : global::UnityEngine.QualitySettings.antiAliasing;
            global::UnityEngine.RenderTextureFormat renderTextureFormat = hdr ? 2 : 0;
            bool flag2 = global::SteamVR_Camera._sceneTexture != null;
            if (flag2)
            {
                bool flag3 = global::SteamVR_Camera._sceneTexture.width != num || global::SteamVR_Camera._sceneTexture.height != num2 || global::SteamVR_Camera._sceneTexture.antiAliasing != num3 || global::SteamVR_Camera._sceneTexture.format != renderTextureFormat;
                if (flag3)
                {
                    global::UnityEngine.Debug.Log(string.Format("Recreating scene texture.. Old: {0}x{1} MSAA={2} [{3}] New: {4}x{5} MSAA={6} [{7}]", new object[]
                    {
                        global::SteamVR_Camera._sceneTexture.width,
                        global::SteamVR_Camera._sceneTexture.height,
                        global::SteamVR_Camera._sceneTexture.antiAliasing,
                        global::SteamVR_Camera._sceneTexture.format,
                        num,
                        num2,
                        num3,
                        renderTextureFormat
                    }));
                    global::UnityEngine.Object.Destroy(global::SteamVR_Camera._sceneTexture);
                    global::SteamVR_Camera._sceneTexture = null;
                }
            }
            bool flag4 = global::SteamVR_Camera._sceneTexture == null;
            if (flag4)
            {
                global::SteamVR_Camera._sceneTexture = new global::UnityEngine.RenderTexture(num, num2, 24, renderTextureFormat);
                global::SteamVR_Camera._sceneTexture.antiAliasing = num3;
                global::Valve.VR.EColorSpace colorSpace = (hdr && global::UnityEngine.QualitySettings.activeColorSpace == null) ? global::Valve.VR.EColorSpace.Gamma : global::Valve.VR.EColorSpace.Auto;
                global::SteamVR.Unity.SetColorSpace(colorSpace);
            }
            result = global::SteamVR_Camera._sceneTexture;
        }
        return(result);
    }
Example #6
0
    // Token: 0x06000090 RID: 144 RVA: 0x000068FC File Offset: 0x00004AFC
    private void OnGUI()
    {
        bool flag = this.overlay == null;

        if (!flag)
        {
            global::UnityEngine.RenderTexture renderTexture = this.overlay.texture as global::UnityEngine.RenderTexture;
            global::UnityEngine.RenderTexture active        = global::UnityEngine.RenderTexture.active;
            global::UnityEngine.RenderTexture.active = renderTexture;
            bool flag2 = global::UnityEngine.Event.current.type == 7;
            if (flag2)
            {
                global::UnityEngine.GL.Clear(false, true, global::UnityEngine.Color.clear);
            }
            global::UnityEngine.Rect rect;
            rect..ctor(0f, 0f, (float)renderTexture.width, (float)renderTexture.height);
            bool flag3 = global::UnityEngine.Screen.width < renderTexture.width;
            if (flag3)
            {
                rect.width = (float)global::UnityEngine.Screen.width;
                this.overlay.uvOffset.x = -(float)(renderTexture.width - global::UnityEngine.Screen.width) / (float)(2 * renderTexture.width);
            }
            bool flag4 = global::UnityEngine.Screen.height < renderTexture.height;
            if (flag4)
            {
                rect.height             = (float)global::UnityEngine.Screen.height;
                this.overlay.uvOffset.y = (float)(renderTexture.height - global::UnityEngine.Screen.height) / (float)(2 * renderTexture.height);
            }
            global::UnityEngine.GUILayout.BeginArea(rect);
            bool flag5 = this.background != null;
            if (flag5)
            {
                global::UnityEngine.GUI.DrawTexture(new global::UnityEngine.Rect((rect.width - (float)this.background.width) / 2f, (rect.height - (float)this.background.height) / 2f, (float)this.background.width, (float)this.background.height), this.background);
            }
            global::UnityEngine.GUILayout.BeginHorizontal(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.FlexibleSpace();
            global::UnityEngine.GUILayout.BeginVertical(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool flag6 = this.logo != null;
            if (flag6)
            {
                global::UnityEngine.GUILayout.Space(rect.height / 2f - this.logoHeight);
                global::UnityEngine.GUILayout.Box(this.logo, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            }
            global::UnityEngine.GUILayout.Space(this.menuOffset);
            bool flag7 = global::UnityEngine.GUILayout.Button("[Esc] - Close menu", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.BeginHorizontal(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.Label(string.Format("Scale: {0:N4}", this.scale), global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            float num   = global::UnityEngine.GUILayout.HorizontalSlider(this.scale, this.scaleLimits.x, this.scaleLimits.y, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool  flag8 = num != this.scale;
            if (flag8)
            {
                this.SetScale(num);
            }
            global::UnityEngine.GUILayout.EndHorizontal();
            global::UnityEngine.GUILayout.BeginHorizontal(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.Label(string.Format("Scale limits:", global::System.Array.Empty <object>()), global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            string text  = global::UnityEngine.GUILayout.TextField(this.scaleLimitX, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool   flag9 = text != this.scaleLimitX;
            if (flag9)
            {
                bool flag10 = float.TryParse(text, ref this.scaleLimits.x);
                if (flag10)
                {
                    this.scaleLimitX = text;
                }
            }
            string text2  = global::UnityEngine.GUILayout.TextField(this.scaleLimitY, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool   flag11 = text2 != this.scaleLimitY;
            if (flag11)
            {
                bool flag12 = float.TryParse(text2, ref this.scaleLimits.y);
                if (flag12)
                {
                    this.scaleLimitY = text2;
                }
            }
            global::UnityEngine.GUILayout.EndHorizontal();
            global::UnityEngine.GUILayout.BeginHorizontal(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.Label(string.Format("Scale rate:", global::System.Array.Empty <object>()), global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            string text3  = global::UnityEngine.GUILayout.TextField(this.scaleRateText, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool   flag13 = text3 != this.scaleRateText;
            if (flag13)
            {
                bool flag14 = float.TryParse(text3, ref this.scaleRate);
                if (flag14)
                {
                    this.scaleRateText = text3;
                }
            }
            global::UnityEngine.GUILayout.EndHorizontal();
            bool active2 = global::SteamVR.active;
            if (active2)
            {
                global::SteamVR instance = global::SteamVR.instance;
                global::UnityEngine.GUILayout.BeginHorizontal(global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                float sceneResolutionScale = global::SteamVR_Camera.sceneResolutionScale;
                int   num2 = (int)(instance.sceneWidth * sceneResolutionScale);
                int   num3 = (int)(instance.sceneHeight * sceneResolutionScale);
                int   num4 = (int)(100f * sceneResolutionScale);
                global::UnityEngine.GUILayout.Label(string.Format("Scene quality: {0}x{1} ({2}%)", num2, num3, num4), global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                int  num5   = global::UnityEngine.Mathf.RoundToInt(global::UnityEngine.GUILayout.HorizontalSlider((float)num4, 50f, 200f, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>()));
                bool flag15 = num5 != num4;
                if (flag15)
                {
                    global::SteamVR_Camera.sceneResolutionScale = (float)num5 / 100f;
                }
                global::UnityEngine.GUILayout.EndHorizontal();
            }
            this.overlay.highquality = global::UnityEngine.GUILayout.Toggle(this.overlay.highquality, "High quality", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            bool highquality = this.overlay.highquality;
            if (highquality)
            {
                this.overlay.curved    = global::UnityEngine.GUILayout.Toggle(this.overlay.curved, "Curved overlay", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                this.overlay.antialias = global::UnityEngine.GUILayout.Toggle(this.overlay.antialias, "Overlay RGSS(2x2)", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            }
            else
            {
                this.overlay.curved    = false;
                this.overlay.antialias = false;
            }
            global::SteamVR_Camera steamVR_Camera = global::SteamVR_Render.Top();
            bool flag16 = steamVR_Camera != null;
            if (flag16)
            {
                steamVR_Camera.wireframe = global::UnityEngine.GUILayout.Toggle(steamVR_Camera.wireframe, "Wireframe", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                global::SteamVR_Render instance2 = global::SteamVR_Render.instance;
                bool flag17 = instance2.trackingSpace == global::Valve.VR.ETrackingUniverseOrigin.TrackingUniverseSeated;
                if (flag17)
                {
                    bool flag18 = global::UnityEngine.GUILayout.Button("Switch to Standing", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                    if (flag18)
                    {
                        instance2.trackingSpace = global::Valve.VR.ETrackingUniverseOrigin.TrackingUniverseStanding;
                    }
                    bool flag19 = global::UnityEngine.GUILayout.Button("Center View", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                    if (flag19)
                    {
                        global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
                        bool flag20 = system != null;
                        if (flag20)
                        {
                            system.ResetSeatedZeroPose();
                        }
                    }
                }
                else
                {
                    bool flag21 = global::UnityEngine.GUILayout.Button("Switch to Seated", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
                    if (flag21)
                    {
                        instance2.trackingSpace = global::Valve.VR.ETrackingUniverseOrigin.TrackingUniverseSeated;
                    }
                }
            }
            bool flag22 = global::UnityEngine.GUILayout.Button("Exit", global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            if (flag22)
            {
                global::UnityEngine.Application.Quit();
            }
            global::UnityEngine.GUILayout.Space(this.menuOffset);
            string environmentVariable = global::System.Environment.GetEnvironmentVariable("VR_OVERRIDE");
            bool   flag23 = environmentVariable != null;
            if (flag23)
            {
                global::UnityEngine.GUILayout.Label("VR_OVERRIDE=" + environmentVariable, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            }
            global::UnityEngine.GUILayout.Label("Graphics device: " + global::UnityEngine.SystemInfo.graphicsDeviceVersion, global::System.Array.Empty <global::UnityEngine.GUILayoutOption>());
            global::UnityEngine.GUILayout.EndVertical();
            global::UnityEngine.GUILayout.FlexibleSpace();
            global::UnityEngine.GUILayout.EndHorizontal();
            global::UnityEngine.GUILayout.EndArea();
            bool flag24 = this.cursor != null;
            if (flag24)
            {
                float x    = global::UnityEngine.Input.mousePosition.x;
                float num6 = (float)global::UnityEngine.Screen.height - global::UnityEngine.Input.mousePosition.y;
                float num7 = (float)this.cursor.width;
                float num8 = (float)this.cursor.height;
                global::UnityEngine.GUI.DrawTexture(new global::UnityEngine.Rect(x, num6, num7, num8), this.cursor);
            }
            global::UnityEngine.RenderTexture.active = active;
            bool flag25 = flag7;
            if (flag25)
            {
                this.HideMenu();
            }
        }
    }
Example #7
0
    // Token: 0x0600003D RID: 61 RVA: 0x00002E60 File Offset: 0x00001060
    private void OnEnable()
    {
        global::SteamVR instance = global::SteamVR.instance;
        bool            flag     = instance == null;

        if (flag)
        {
            bool flag2 = this.head != null;
            if (flag2)
            {
                this.head.GetComponent <global::SteamVR_GameView>().enabled      = false;
                this.head.GetComponent <global::SteamVR_TrackedObject>().enabled = false;
            }
            bool flag3 = this.flip != null;
            if (flag3)
            {
                this.flip.enabled = false;
            }
            base.enabled = false;
        }
        else
        {
            this.Expand();
            bool flag4 = global::SteamVR_Camera.blitMaterial == null;
            if (flag4)
            {
                global::SteamVR_Camera.blitMaterial = new global::UnityEngine.Material(global::EscalationVR.UnityHelper.GetShader("Custom/SteamVR_Blit"));
            }
            global::UnityEngine.Camera component = base.GetComponent <global::UnityEngine.Camera>();
            component.fieldOfView  = instance.fieldOfView;
            component.aspect       = instance.aspect;
            component.eventMask    = 0;
            component.orthographic = false;
            component.enabled      = false;
            bool flag5 = component.actualRenderingPath != 1 && global::UnityEngine.QualitySettings.antiAliasing > 1;
            if (flag5)
            {
                global::UnityEngine.Debug.LogWarning("MSAA only supported in Forward rendering path. (disabling MSAA)");
                global::UnityEngine.QualitySettings.antiAliasing = 0;
            }
            global::UnityEngine.Camera component2 = this.head.GetComponent <global::UnityEngine.Camera>();
            bool flag6 = component2 != null;
            if (flag6)
            {
                component2.allowHDR      = component.allowHDR;
                component2.renderingPath = component.renderingPath;
            }
            bool flag7 = this.ears == null;
            if (flag7)
            {
                global::SteamVR_Ears componentInChildren = base.transform.GetComponentInChildren <global::SteamVR_Ears>();
                bool flag8 = componentInChildren != null;
                if (flag8)
                {
                    this._ears = componentInChildren.transform;
                }
            }
            bool flag9 = this.ears != null;
            if (flag9)
            {
                this.ears.GetComponent <global::SteamVR_Ears>().vrcam = this;
            }
            global::SteamVR_Render.Add(this);
        }
    }
Example #8
0
    // Token: 0x060000BF RID: 191 RVA: 0x00008760 File Offset: 0x00006960
    private void Update()
    {
        bool flag = this.cameras.Length == 0;

        if (flag)
        {
            base.enabled = false;
        }
        else
        {
            global::SteamVR_Utils.QueueEventOnRenderThread(201510024);
            global::SteamVR_Controller.Update();
            global::Valve.VR.CVRSystem system = global::Valve.VR.OpenVR.System;
            bool flag2 = system != null;
            if (flag2)
            {
                global::Valve.VR.VREvent_t vrevent_t = default(global::Valve.VR.VREvent_t);
                uint uncbVREvent = (uint)global::System.Runtime.InteropServices.Marshal.SizeOf(typeof(global::Valve.VR.VREvent_t));
                int  i           = 0;
                while (i < 64)
                {
                    bool flag3 = !system.PollNextEvent(ref vrevent_t, uncbVREvent);
                    if (flag3)
                    {
                        break;
                    }
                    global::Valve.VR.EVREventType eventType    = (global::Valve.VR.EVREventType)vrevent_t.eventType;
                    global::Valve.VR.EVREventType evreventType = eventType;
                    if (evreventType <= global::Valve.VR.EVREventType.VREvent_InputFocusReleased)
                    {
                        if (evreventType != global::Valve.VR.EVREventType.VREvent_InputFocusCaptured)
                        {
                            if (evreventType != global::Valve.VR.EVREventType.VREvent_InputFocusReleased)
                            {
                                goto IL_16D;
                            }
                            bool flag4 = vrevent_t.data.process.pid == 0U;
                            if (flag4)
                            {
                                global::SteamVR_Utils.Event.Send("input_focus", new object[]
                                {
                                    true
                                });
                            }
                        }
                        else
                        {
                            bool flag5 = vrevent_t.data.process.oldPid == 0U;
                            if (flag5)
                            {
                                global::SteamVR_Utils.Event.Send("input_focus", new object[]
                                {
                                    false
                                });
                            }
                        }
                    }
                    else if (evreventType != global::Valve.VR.EVREventType.VREvent_HideRenderModels)
                    {
                        if (evreventType != global::Valve.VR.EVREventType.VREvent_ShowRenderModels)
                        {
                            goto IL_16D;
                        }
                        global::SteamVR_Utils.Event.Send("hide_render_models", new object[]
                        {
                            false
                        });
                    }
                    else
                    {
                        global::SteamVR_Utils.Event.Send("hide_render_models", new object[]
                        {
                            true
                        });
                    }
IL_1B3:
                    i++;
                    continue;
IL_16D:
                    string name = global::System.Enum.GetName(typeof(global::Valve.VR.EVREventType), vrevent_t.eventType);
                    bool flag6 = name != null;
                    if (flag6)
                    {
                        global::SteamVR_Utils.Event.Send(name.Substring(8), new object[]
                        {
                            vrevent_t
                        });
                    }
                    goto IL_1B3;
                }
            }
            global::UnityEngine.Application.targetFrameRate     = -1;
            global::UnityEngine.Application.runInBackground     = true;
            global::UnityEngine.QualitySettings.maxQueuedFrames = -1;
            global::UnityEngine.QualitySettings.vSyncCount      = 0;
            bool flag7 = this.lockPhysicsUpdateRateToRenderFrequency && global::UnityEngine.Time.timeScale > 0f;
            if (flag7)
            {
                global::SteamVR instance = global::SteamVR.instance;
                bool            flag8    = instance != null;
                if (flag8)
                {
                    global::Valve.VR.Compositor_FrameTiming compositor_FrameTiming = default(global::Valve.VR.Compositor_FrameTiming);
                    compositor_FrameTiming.m_nSize = (uint)global::System.Runtime.InteropServices.Marshal.SizeOf(typeof(global::Valve.VR.Compositor_FrameTiming));
                    instance.compositor.GetFrameTiming(ref compositor_FrameTiming, 0U);
                    global::UnityEngine.Time.fixedDeltaTime   = global::UnityEngine.Time.timeScale / instance.hmd_DisplayFrequency;
                    global::UnityEngine.Time.maximumDeltaTime = global::UnityEngine.Time.fixedDeltaTime * compositor_FrameTiming.m_nNumFramePresents;
                }
            }
        }
    }