コード例 #1
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;
    }
コード例 #2
0
    // 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();
        }
    }
コード例 #3
0
    // Token: 0x0600008F RID: 143 RVA: 0x00006868 File Offset: 0x00004A68
    private void Awake()
    {
        this.scaleLimitX   = string.Format("{0:N1}", this.scaleLimits.x);
        this.scaleLimitY   = string.Format("{0:N1}", this.scaleLimits.y);
        this.scaleRateText = string.Format("{0:N1}", this.scaleRate);
        global::SteamVR_Overlay instance = global::SteamVR_Overlay.instance;
        bool flag = instance != null;

        if (flag)
        {
            this.uvOffset = instance.uvOffset;
            this.distance = instance.distance;
        }
    }
コード例 #4
0
    // Token: 0x06000072 RID: 114 RVA: 0x00005110 File Offset: 0x00003310
    private void OnPostRender()
    {
        bool flag = this.currentColor != this.targetColor;

        if (flag)
        {
            bool flag2 = global::UnityEngine.Mathf.Abs(this.currentColor.a - this.targetColor.a) < global::UnityEngine.Mathf.Abs(this.deltaColor.a) * global::UnityEngine.Time.deltaTime;
            if (flag2)
            {
                this.currentColor = this.targetColor;
                this.deltaColor   = new global::UnityEngine.Color(0f, 0f, 0f, 0f);
            }
            else
            {
                this.currentColor += this.deltaColor * global::UnityEngine.Time.deltaTime;
            }
            bool flag3 = this.fadeOverlay;
            if (flag3)
            {
                global::SteamVR_Overlay instance = global::SteamVR_Overlay.instance;
                bool flag4 = instance != null;
                if (flag4)
                {
                    instance.alpha = 1f - this.currentColor.a;
                }
            }
        }
        bool flag5 = this.currentColor.a > 0f && global::SteamVR_Fade.fadeMaterial;

        if (flag5)
        {
            global::UnityEngine.GL.PushMatrix();
            global::UnityEngine.GL.LoadOrtho();
            global::SteamVR_Fade.fadeMaterial.SetPass(0);
            global::UnityEngine.GL.Begin(7);
            global::UnityEngine.GL.Color(this.currentColor);
            global::UnityEngine.GL.Vertex3(0f, 0f, 0f);
            global::UnityEngine.GL.Vertex3(1f, 0f, 0f);
            global::UnityEngine.GL.Vertex3(1f, 1f, 0f);
            global::UnityEngine.GL.Vertex3(0f, 1f, 0f);
            global::UnityEngine.GL.End();
            global::UnityEngine.GL.PopMatrix();
        }
    }
コード例 #5
0
    // Token: 0x06000091 RID: 145 RVA: 0x00006FC8 File Offset: 0x000051C8
    public void ShowMenu()
    {
        global::SteamVR_Overlay instance = global::SteamVR_Overlay.instance;
        bool flag = instance == null;

        if (!flag)
        {
            global::UnityEngine.RenderTexture renderTexture = instance.texture as global::UnityEngine.RenderTexture;
            bool flag2 = renderTexture == null;
            if (flag2)
            {
                global::UnityEngine.Debug.LogError("Menu requires overlay texture to be a render texture.");
            }
            else
            {
                this.SaveCursorState();
                global::UnityEngine.Cursor.visible   = true;
                global::UnityEngine.Cursor.lockState = 0;
                this.overlay  = instance;
                this.uvOffset = instance.uvOffset;
                this.distance = instance.distance;
                global::UnityEngine.Camera[] array = global::UnityEngine.Object.FindObjectsOfType(typeof(global::UnityEngine.Camera)) as global::UnityEngine.Camera[];
                foreach (global::UnityEngine.Camera camera in array)
                {
                    bool flag3 = camera.enabled && camera.targetTexture == renderTexture;
                    if (flag3)
                    {
                        this.overlayCam         = camera;
                        this.overlayCam.enabled = false;
                        break;
                    }
                }
                global::SteamVR_Camera steamVR_Camera = global::SteamVR_Render.Top();
                bool flag4 = steamVR_Camera != null;
                if (flag4)
                {
                    this.scale = steamVR_Camera.origin.localScale.x;
                }
            }
        }
    }
コード例 #6
0
 // Token: 0x060000E9 RID: 233 RVA: 0x0000A130 File Offset: 0x00008330
 private void Update()
 {
     foreach (int num in this.controllerIndices)
     {
         global::SteamVR_Overlay instance = global::SteamVR_Overlay.instance;
         bool flag = instance && this.point && this.pointer;
         if (flag)
         {
             global::SteamVR_Utils.RigidTransform transform = global::SteamVR_Controller.Input(num).transform;
             this.pointer.transform.localPosition = transform.pos;
             this.pointer.transform.localRotation = transform.rot;
             global::SteamVR_Overlay.IntersectionResults intersectionResults = default(global::SteamVR_Overlay.IntersectionResults);
             bool flag2 = instance.ComputeIntersection(transform.pos, transform.rot * global::UnityEngine.Vector3.forward, ref intersectionResults);
             bool flag3 = flag2;
             if (flag3)
             {
                 this.point.transform.localPosition = intersectionResults.point;
                 this.point.transform.localRotation = global::UnityEngine.Quaternion.LookRotation(intersectionResults.normal);
             }
         }
         else
         {
             foreach (global::Valve.VR.EVRButtonId evrbuttonId in this.buttonIds)
             {
                 bool pressDown = global::SteamVR_Controller.Input(num).GetPressDown(evrbuttonId);
                 if (pressDown)
                 {
                     global::UnityEngine.Debug.Log(evrbuttonId.ToString() + " press down");
                 }
                 bool pressUp = global::SteamVR_Controller.Input(num).GetPressUp(evrbuttonId);
                 if (pressUp)
                 {
                     global::UnityEngine.Debug.Log(evrbuttonId.ToString() + " press up");
                     bool flag4 = evrbuttonId == global::Valve.VR.EVRButtonId.k_EButton_Axis1;
                     if (flag4)
                     {
                         global::SteamVR_Controller.Input(num).TriggerHapticPulse(500, global::Valve.VR.EVRButtonId.k_EButton_Axis0);
                         this.PrintControllerStatus(num);
                     }
                 }
                 bool press = global::SteamVR_Controller.Input(num).GetPress(evrbuttonId);
                 if (press)
                 {
                     global::UnityEngine.Debug.Log(evrbuttonId);
                 }
             }
             foreach (global::Valve.VR.EVRButtonId buttonId in this.axisIds)
             {
                 bool touchDown = global::SteamVR_Controller.Input(num).GetTouchDown(buttonId);
                 if (touchDown)
                 {
                     global::UnityEngine.Debug.Log(buttonId.ToString() + " touch down");
                 }
                 bool touchUp = global::SteamVR_Controller.Input(num).GetTouchUp(buttonId);
                 if (touchUp)
                 {
                     global::UnityEngine.Debug.Log(buttonId.ToString() + " touch up");
                 }
                 bool touch = global::SteamVR_Controller.Input(num).GetTouch(buttonId);
                 if (touch)
                 {
                     global::UnityEngine.Vector2 axis = global::SteamVR_Controller.Input(num).GetAxis(buttonId);
                     string text = "axis: ";
                     global::UnityEngine.Vector2 vector = axis;
                     global::UnityEngine.Debug.Log(text + vector.ToString());
                 }
             }
         }
     }
 }