Example #1
0
    // Token: 0x060000B1 RID: 177 RVA: 0x000081F8 File Offset: 0x000063F8
    private void AddInternal(global::SteamVR_Camera vrcam)
    {
        global::UnityEngine.Camera component = vrcam.GetComponent <global::UnityEngine.Camera>();
        int num = this.cameras.Length;

        global::SteamVR_Camera[] array = new global::SteamVR_Camera[num + 1];
        int num2 = 0;

        for (int i = 0; i < num; i++)
        {
            global::UnityEngine.Camera component2 = this.cameras[i].GetComponent <global::UnityEngine.Camera>();
            bool flag = i == num2 && component2.depth > component.depth;
            if (flag)
            {
                array[num2++] = vrcam;
            }
            array[num2++] = this.cameras[i];
        }
        bool flag2 = num2 == num;

        if (flag2)
        {
            array[num2] = vrcam;
        }
        this.cameras = array;
        base.enabled = true;
    }
Example #2
0
    // Token: 0x060000B2 RID: 178 RVA: 0x0000829C File Offset: 0x0000649C
    private void RemoveInternal(global::SteamVR_Camera vrcam)
    {
        int num  = this.cameras.Length;
        int num2 = 0;

        for (int i = 0; i < num; i++)
        {
            global::SteamVR_Camera steamVR_Camera = this.cameras[i];
            bool flag = steamVR_Camera == vrcam;
            if (flag)
            {
                num2++;
            }
        }
        bool flag2 = num2 == 0;

        if (!flag2)
        {
            global::SteamVR_Camera[] array = new global::SteamVR_Camera[num - num2];
            int num3 = 0;
            for (int j = 0; j < num; j++)
            {
                global::SteamVR_Camera steamVR_Camera2 = this.cameras[j];
                bool flag3 = steamVR_Camera2 != vrcam;
                if (flag3)
                {
                    array[num3++] = steamVR_Camera2;
                }
            }
            this.cameras = array;
        }
    }
    // Token: 0x06000089 RID: 137 RVA: 0x0000658C File Offset: 0x0000478C
    private ulong GetOverlayHandle(string overlayName, global::UnityEngine.Transform transform, float widthInMeters = 1f)
    {
        ulong num = 0UL;

        global::Valve.VR.CVROverlay overlay = global::Valve.VR.OpenVR.Overlay;
        bool  flag = overlay == null;
        ulong result;

        if (flag)
        {
            result = num;
        }
        else
        {
            string pchOverlayKey = global::SteamVR_Overlay.key + "." + overlayName;
            global::Valve.VR.EVROverlayError evroverlayError = overlay.FindOverlay(pchOverlayKey, ref num);
            bool flag2 = evroverlayError > global::Valve.VR.EVROverlayError.None;
            if (flag2)
            {
                evroverlayError = overlay.CreateOverlay(pchOverlayKey, overlayName, ref num);
            }
            bool flag3 = evroverlayError == global::Valve.VR.EVROverlayError.None;
            if (flag3)
            {
                overlay.ShowOverlay(num);
                overlay.SetOverlayAlpha(num, this.alpha);
                overlay.SetOverlayWidthInMeters(num, widthInMeters);
                bool flag4 = global::SteamVR.instance.graphicsAPI == global::Valve.VR.EGraphicsAPIConvention.API_DirectX;
                if (flag4)
                {
                    global::Valve.VR.VRTextureBounds_t vrtextureBounds_t = default(global::Valve.VR.VRTextureBounds_t);
                    vrtextureBounds_t.uMin = 0f;
                    vrtextureBounds_t.vMin = 1f;
                    vrtextureBounds_t.uMax = 1f;
                    vrtextureBounds_t.vMax = 0f;
                    overlay.SetOverlayTextureBounds(num, ref vrtextureBounds_t);
                }
                global::SteamVR_Camera steamVR_Camera = (this.loadingScreenDistance == 0f) ? global::SteamVR_Render.Top() : null;
                bool flag5 = steamVR_Camera != null && steamVR_Camera.origin != null;
                if (flag5)
                {
                    global::SteamVR_Utils.RigidTransform rigidTransform = new global::SteamVR_Utils.RigidTransform(steamVR_Camera.origin, transform);
                    rigidTransform.pos.x = rigidTransform.pos.x / steamVR_Camera.origin.localScale.x;
                    rigidTransform.pos.y = rigidTransform.pos.y / steamVR_Camera.origin.localScale.y;
                    rigidTransform.pos.z = rigidTransform.pos.z / steamVR_Camera.origin.localScale.z;
                    global::Valve.VR.HmdMatrix34_t hmdMatrix34_t = rigidTransform.ToHmdMatrix34();
                    overlay.SetOverlayTransformAbsolute(num, global::SteamVR_Render.instance.trackingSpace, ref hmdMatrix34_t);
                }
                else
                {
                    global::Valve.VR.HmdMatrix34_t hmdMatrix34_t2 = new global::SteamVR_Utils.RigidTransform(transform).ToHmdMatrix34();
                    overlay.SetOverlayTransformAbsolute(num, global::SteamVR_Render.instance.trackingSpace, ref hmdMatrix34_t2);
                }
            }
            result = num;
        }
        return(result);
    }
Example #4
0
    // Token: 0x060000AF RID: 175 RVA: 0x00008198 File Offset: 0x00006398
    public static void Remove(global::SteamVR_Camera vrcam)
    {
        bool flag = !global::SteamVR_Render.isQuitting && global::SteamVR_Render._instance != null;

        if (flag)
        {
            global::SteamVR_Render.instance.RemoveInternal(vrcam);
        }
    }
Example #5
0
    // Token: 0x060000AE RID: 174 RVA: 0x00008170 File Offset: 0x00006370
    public static void Add(global::SteamVR_Camera vrcam)
    {
        bool flag = !global::SteamVR_Render.isQuitting;

        if (flag)
        {
            global::SteamVR_Render.instance.AddInternal(vrcam);
        }
    }
Example #6
0
        // Token: 0x0600031A RID: 794 RVA: 0x00011508 File Offset: 0x0000F708
        public void Apply()
        {
            global::UnityEngine.Quaternion quaternion = global::UnityEngine.Quaternion.Euler(0f, this.Rotation, 0f);
            global::SteamVR_Camera         steamCam   = global::VRGIN.Core.VR.Camera.SteamCam;

            steamCam.origin.position = this.Position - quaternion * new global::UnityEngine.Vector3(steamCam.head.transform.localPosition.x, 0f, steamCam.head.transform.localPosition.z) * this.Scale;
            steamCam.origin.rotation = quaternion;
            global::VRGIN.Core.VR.Settings.IPDScale = this.Scale;
        }
Example #7
0
    // Token: 0x0600003F RID: 63 RVA: 0x0000301C File Offset: 0x0000121C
    public void ForceLast()
    {
        bool flag = global::SteamVR_Camera.values != null;

        if (flag)
        {
            foreach (object obj in global::SteamVR_Camera.values)
            {
                global::System.Collections.DictionaryEntry dictionaryEntry = (global::System.Collections.DictionaryEntry)obj;
                global::System.Reflection.FieldInfo        fieldInfo       = dictionaryEntry.Key as global::System.Reflection.FieldInfo;
                fieldInfo.SetValue(this, dictionaryEntry.Value);
            }
            global::SteamVR_Camera.values = null;
        }
        else
        {
            global::UnityEngine.Component[] components = base.GetComponents <global::UnityEngine.Component>();
            for (int i = 0; i < components.Length; i++)
            {
                global::SteamVR_Camera steamVR_Camera = components[i] as global::SteamVR_Camera;
                bool flag2 = steamVR_Camera != null && steamVR_Camera != this;
                if (flag2)
                {
                    bool flag3 = steamVR_Camera.flip != null;
                    if (flag3)
                    {
                        global::UnityEngine.Object.DestroyImmediate(steamVR_Camera.flip);
                    }
                    global::UnityEngine.Object.DestroyImmediate(steamVR_Camera);
                }
            }
            components = base.GetComponents <global::UnityEngine.Component>();
            bool flag4 = this != components[components.Length - 1] || this.flip == null;
            if (flag4)
            {
                bool flag5 = this.flip == null;
                if (flag5)
                {
                    this.flip = base.gameObject.AddComponent <global::SteamVR_CameraFlip>();
                }
                global::SteamVR_Camera.values = new global::System.Collections.Hashtable();
                global::System.Reflection.FieldInfo[] fields = base.GetType().GetFields(52);
                foreach (global::System.Reflection.FieldInfo fieldInfo2 in fields)
                {
                    bool flag6 = fieldInfo2.IsPublic || fieldInfo2.IsDefined(typeof(global::UnityEngine.SerializeField), true);
                    if (flag6)
                    {
                        global::SteamVR_Camera.values[fieldInfo2] = fieldInfo2.GetValue(this);
                    }
                }
                global::UnityEngine.GameObject gameObject = base.gameObject;
                global::UnityEngine.Object.DestroyImmediate(this);
                gameObject.AddComponent <global::SteamVR_Camera>().ForceLast();
            }
        }
    }
Example #8
0
    // Token: 0x06000094 RID: 148 RVA: 0x00007258 File Offset: 0x00005458
    private void SetScale(float scale)
    {
        this.scale = scale;
        global::SteamVR_Camera steamVR_Camera = global::SteamVR_Render.Top();
        bool flag = steamVR_Camera != null;

        if (flag)
        {
            steamVR_Camera.origin.localScale = new global::UnityEngine.Vector3(scale, scale, scale);
        }
    }
Example #9
0
    // Token: 0x06000065 RID: 101 RVA: 0x0000472C File Offset: 0x0000292C
    public void AttachToCamera(global::SteamVR_Camera vrcam)
    {
        bool flag = this.target == vrcam.head;

        if (!flag)
        {
            this.target = vrcam.head;
            global::UnityEngine.Transform parent  = base.transform.parent;
            global::UnityEngine.Transform parent2 = vrcam.head.parent;
            parent.parent        = parent2;
            parent.localPosition = global::UnityEngine.Vector3.zero;
            parent.localRotation = global::UnityEngine.Quaternion.identity;
            parent.localScale    = global::UnityEngine.Vector3.one;
            vrcam.enabled        = false;
            global::UnityEngine.GameObject gameObject = global::UnityEngine.Object.Instantiate <global::UnityEngine.GameObject>(vrcam.gameObject);
            vrcam.enabled   = true;
            gameObject.name = "camera";
            global::UnityEngine.Object.DestroyImmediate(gameObject.GetComponent <global::SteamVR_Camera>());
            global::UnityEngine.Object.DestroyImmediate(gameObject.GetComponent <global::SteamVR_CameraFlip>());
            this.cam                     = gameObject.GetComponent <global::UnityEngine.Camera>();
            this.cam.fieldOfView         = this.config.fov;
            this.cam.useOcclusionCulling = false;
            this.cam.enabled             = false;
            this.colorMat                = new global::UnityEngine.Material(global::EscalationVR.UnityHelper.GetShader("Custom/SteamVR_ColorOut"));
            this.alphaMat                = new global::UnityEngine.Material(global::EscalationVR.UnityHelper.GetShader("Custom/SteamVR_AlphaOut"));
            this.clipMaterial            = new global::UnityEngine.Material(global::EscalationVR.UnityHelper.GetShader("Custom/SteamVR_ClearAll"));
            global::UnityEngine.Transform transform = gameObject.transform;
            transform.parent        = base.transform;
            transform.localPosition = new global::UnityEngine.Vector3(this.config.x, this.config.y, this.config.z);
            transform.localRotation = global::UnityEngine.Quaternion.Euler(this.config.rx, this.config.ry, this.config.rz);
            transform.localScale    = global::UnityEngine.Vector3.one;
            while (transform.childCount > 0)
            {
                global::UnityEngine.Object.DestroyImmediate(transform.GetChild(0).gameObject);
            }
            this.clipQuad      = global::UnityEngine.GameObject.CreatePrimitive(5);
            this.clipQuad.name = "ClipQuad";
            global::UnityEngine.Object.DestroyImmediate(this.clipQuad.GetComponent <global::UnityEngine.MeshCollider>());
            global::UnityEngine.MeshRenderer component = this.clipQuad.GetComponent <global::UnityEngine.MeshRenderer>();
            component.material             = this.clipMaterial;
            component.shadowCastingMode    = 0;
            component.receiveShadows       = false;
            component.useLightProbes       = false;
            component.reflectionProbeUsage = 0;
            global::UnityEngine.Transform transform2 = this.clipQuad.transform;
            transform2.parent        = transform;
            transform2.localScale    = new global::UnityEngine.Vector3(1000f, 1000f, 1f);
            transform2.localRotation = global::UnityEngine.Quaternion.identity;
            this.clipQuad.SetActive(false);
        }
    }
Example #10
0
        // Token: 0x060002C1 RID: 705 RVA: 0x000108F4 File Offset: 0x0000EAF4
        public void UpdatePosition()
        {
            global::SteamVR_Camera steamCam = global::VRGIN.Core.VRCamera.Instance.SteamCam;
            float num  = 2f;
            float y    = steamCam.head.localPosition.y;
            float num2 = 1f;

            base.transform.position               = this.Area.Position;
            base.transform.localScale             = global::UnityEngine.Vector3.one * this.Area.Scale;
            this.PlayArea.transform.localPosition = -new global::UnityEngine.Vector3(steamCam.head.transform.localPosition.x, 0f, steamCam.head.transform.localPosition.z);
            base.transform.rotation               = global::UnityEngine.Quaternion.Euler(0f, this.Area.Rotation, 0f);
            this.Indicator.localScale             = global::UnityEngine.Vector3.one * 0.1f + global::UnityEngine.Vector3.one * global::UnityEngine.Mathf.Sin(global::UnityEngine.Time.time * 5f) * 0.05f;
            this.HeightIndicator.localScale       = new global::UnityEngine.Vector3(0.01f, y / num, 0.01f);
            this.HeightIndicator.localPosition    = new global::UnityEngine.Vector3(0f, y - num2 * (y / num), 0f);
        }
Example #11
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;
                }
            }
        }
    }
Example #12
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 #13
0
    // Token: 0x0600009D RID: 157 RVA: 0x000073DC File Offset: 0x000055DC
    public void UpdateOverlay()
    {
        global::Valve.VR.CVROverlay overlay = global::Valve.VR.OpenVR.Overlay;
        bool flag = overlay == null;

        if (!flag)
        {
            bool flag2 = this.texture != null;
            if (flag2)
            {
                global::Valve.VR.EVROverlayError evroverlayError = overlay.ShowOverlay(this.handle);
                bool flag3 = evroverlayError == global::Valve.VR.EVROverlayError.InvalidHandle || evroverlayError == global::Valve.VR.EVROverlayError.UnknownOverlay;
                if (flag3)
                {
                    bool flag4 = overlay.FindOverlay(global::SteamVR_Overlay.key, ref this.handle) > global::Valve.VR.EVROverlayError.None;
                    if (flag4)
                    {
                        return;
                    }
                }
                global::Valve.VR.Texture_t texture_t = default(global::Valve.VR.Texture_t);
                texture_t.handle      = this.texture.GetNativeTexturePtr();
                texture_t.eType       = global::SteamVR.instance.graphicsAPI;
                texture_t.eColorSpace = global::Valve.VR.EColorSpace.Auto;
                overlay.SetOverlayTexture(this.handle, ref texture_t);
                overlay.SetOverlayAlpha(this.handle, this.alpha);
                overlay.SetOverlayWidthInMeters(this.handle, this.scale);
                overlay.SetOverlayAutoCurveDistanceRangeInMeters(this.handle, this.curvedRange.x, this.curvedRange.y);
                global::Valve.VR.VRTextureBounds_t vrtextureBounds_t = default(global::Valve.VR.VRTextureBounds_t);
                vrtextureBounds_t.uMin = (0f + this.uvOffset.x) * this.uvOffset.z;
                vrtextureBounds_t.vMin = (1f + this.uvOffset.y) * this.uvOffset.w;
                vrtextureBounds_t.uMax = (1f + this.uvOffset.x) * this.uvOffset.z;
                vrtextureBounds_t.vMax = (0f + this.uvOffset.y) * this.uvOffset.w;
                overlay.SetOverlayTextureBounds(this.handle, ref vrtextureBounds_t);
                global::Valve.VR.HmdVector2_t hmdVector2_t = default(global::Valve.VR.HmdVector2_t);
                hmdVector2_t.v0 = this.mouseScale.x;
                hmdVector2_t.v1 = this.mouseScale.y;
                overlay.SetOverlayMouseScale(this.handle, ref hmdVector2_t);
                global::SteamVR_Camera steamVR_Camera = global::SteamVR_Render.Top();
                bool flag5 = steamVR_Camera != null && steamVR_Camera.origin != null;
                if (flag5)
                {
                    global::SteamVR_Utils.RigidTransform rigidTransform = new global::SteamVR_Utils.RigidTransform(steamVR_Camera.origin, base.transform);
                    rigidTransform.pos.x = rigidTransform.pos.x / steamVR_Camera.origin.localScale.x;
                    rigidTransform.pos.y = rigidTransform.pos.y / steamVR_Camera.origin.localScale.y;
                    rigidTransform.pos.z = rigidTransform.pos.z / steamVR_Camera.origin.localScale.z;
                    rigidTransform.pos.z = rigidTransform.pos.z + this.distance;
                    global::Valve.VR.HmdMatrix34_t hmdMatrix34_t = rigidTransform.ToHmdMatrix34();
                    overlay.SetOverlayTransformAbsolute(this.handle, global::SteamVR_Render.instance.trackingSpace, ref hmdMatrix34_t);
                }
                overlay.SetOverlayInputMethod(this.handle, this.inputMethod);
                bool flag6 = this.curved || this.antialias;
                if (flag6)
                {
                    this.highquality = true;
                }
                bool flag7 = this.highquality;
                if (flag7)
                {
                    overlay.SetHighQualityOverlay(this.handle);
                    overlay.SetOverlayFlag(this.handle, global::Valve.VR.VROverlayFlags.Curved, this.curved);
                    overlay.SetOverlayFlag(this.handle, global::Valve.VR.VROverlayFlags.RGSS4X, this.antialias);
                }
                else
                {
                    bool flag8 = overlay.GetHighQualityOverlay() == this.handle;
                    if (flag8)
                    {
                        overlay.SetHighQualityOverlay(0UL);
                    }
                }
            }
            else
            {
                overlay.HideOverlay(this.handle);
            }
        }
    }