Ejemplo n.º 1
0
    // Token: 0x060000A1 RID: 161 RVA: 0x00007990 File Offset: 0x00005B90
    public static bool GetBounds(global::SteamVR_PlayArea.Size size, ref global::Valve.VR.HmdQuad_t pRect)
    {
        bool flag = size == global::SteamVR_PlayArea.Size.Calibrated;
        bool result;

        if (flag)
        {
            bool flag2 = !global::SteamVR.active && !global::SteamVR.usingNativeSupport;
            bool flag3 = flag2;
            if (flag3)
            {
                global::Valve.VR.EVRInitError evrinitError = global::Valve.VR.EVRInitError.None;
                global::Valve.VR.OpenVR.Init(ref evrinitError, global::Valve.VR.EVRApplicationType.VRApplication_Other);
            }
            global::Valve.VR.CVRChaperone chaperone = global::Valve.VR.OpenVR.Chaperone;
            bool flag4 = chaperone != null && chaperone.GetPlayAreaRect(ref pRect);
            bool flag5 = !flag4;
            if (flag5)
            {
                global::UnityEngine.Debug.LogWarning("Failed to get Calibrated Play Area bounds!  Make sure you have tracking first, and that your space is calibrated.");
            }
            bool flag6 = flag2;
            if (flag6)
            {
                global::Valve.VR.OpenVR.Shutdown();
            }
            result = flag4;
        }
        else
        {
            try
            {
                string   text  = size.ToString().Substring(1);
                string[] array = text.Split(new char[]
                {
                    'x'
                }, 2);
                float num  = float.Parse(array[0]) / 200f;
                float num2 = float.Parse(array[1]) / 200f;
                pRect.vCorners0.v0 = num;
                pRect.vCorners0.v1 = 0f;
                pRect.vCorners0.v2 = num2;
                pRect.vCorners1.v0 = num;
                pRect.vCorners1.v1 = 0f;
                pRect.vCorners1.v2 = -num2;
                pRect.vCorners2.v0 = -num;
                pRect.vCorners2.v1 = 0f;
                pRect.vCorners2.v2 = -num2;
                pRect.vCorners3.v0 = -num;
                pRect.vCorners3.v1 = 0f;
                pRect.vCorners3.v2 = num2;
                return(true);
            }
            catch
            {
            }
            result = false;
        }
        return(result);
    }
Ejemplo n.º 2
0
        // Token: 0x0600015E RID: 350 RVA: 0x0000BE4C File Offset: 0x0000A04C
        public bool GetLiveCollisionBoundsInfo(out global::Valve.VR.HmdQuad_t[] pQuadsBuffer)
        {
            uint num  = 0U;
            bool flag = this.FnTable.GetLiveCollisionBoundsInfo(null, ref num);

            pQuadsBuffer = new global::Valve.VR.HmdQuad_t[num];
            return(this.FnTable.GetLiveCollisionBoundsInfo(pQuadsBuffer, ref num));
        }
Ejemplo n.º 3
0
 // Token: 0x06000152 RID: 338 RVA: 0x0000BCA4 File Offset: 0x00009EA4
 public bool GetPlayAreaRect(ref global::Valve.VR.HmdQuad_t rect)
 {
     return(this.FnTable.GetPlayAreaRect(ref rect));
 }
Ejemplo n.º 4
0
    // Token: 0x060000A2 RID: 162 RVA: 0x00007B2C File Offset: 0x00005D2C
    public void BuildMesh()
    {
        global::Valve.VR.HmdQuad_t hmdQuad_t = default(global::Valve.VR.HmdQuad_t);
        bool flag = !global::SteamVR_PlayArea.GetBounds(this.size, ref hmdQuad_t);

        if (!flag)
        {
            global::Valve.VR.HmdVector3_t[] array = new global::Valve.VR.HmdVector3_t[]
            {
                hmdQuad_t.vCorners0,
                hmdQuad_t.vCorners1,
                hmdQuad_t.vCorners2,
                hmdQuad_t.vCorners3
            };
            this.vertices = new global::UnityEngine.Vector3[array.Length * 2];
            for (int i = 0; i < array.Length; i++)
            {
                global::Valve.VR.HmdVector3_t hmdVector3_t = array[i];
                this.vertices[i] = new global::UnityEngine.Vector3(hmdVector3_t.v0, 0.01f, hmdVector3_t.v2);
            }
            bool flag2 = this.borderThickness == 0f;
            if (flag2)
            {
                base.GetComponent <global::UnityEngine.MeshFilter>().mesh = null;
            }
            else
            {
                for (int j = 0; j < array.Length; j++)
                {
                    int num  = (j + 1) % array.Length;
                    int num2 = (j + array.Length - 1) % array.Length;
                    global::UnityEngine.Vector3 normalized  = (this.vertices[num] - this.vertices[j]).normalized;
                    global::UnityEngine.Vector3 normalized2 = (this.vertices[num2] - this.vertices[j]).normalized;
                    global::UnityEngine.Vector3 vector      = this.vertices[j];
                    vector += global::UnityEngine.Vector3.Cross(normalized, global::UnityEngine.Vector3.up) * this.borderThickness;
                    vector += global::UnityEngine.Vector3.Cross(normalized2, global::UnityEngine.Vector3.down) * this.borderThickness;
                    this.vertices[array.Length + j] = vector;
                }
                int[] triangles = new int[]
                {
                    0,
                    1,
                    4,
                    1,
                    5,
                    4,
                    1,
                    2,
                    5,
                    2,
                    6,
                    5,
                    2,
                    3,
                    6,
                    3,
                    7,
                    6,
                    3,
                    0,
                    7,
                    0,
                    4,
                    7
                };
                global::UnityEngine.Vector2[] uv = new global::UnityEngine.Vector2[]
                {
                    new global::UnityEngine.Vector2(0f, 0f),
                    new global::UnityEngine.Vector2(1f, 0f),
                    new global::UnityEngine.Vector2(0f, 0f),
                    new global::UnityEngine.Vector2(1f, 0f),
                    new global::UnityEngine.Vector2(0f, 1f),
                    new global::UnityEngine.Vector2(1f, 1f),
                    new global::UnityEngine.Vector2(0f, 1f),
                    new global::UnityEngine.Vector2(1f, 1f)
                };
                global::UnityEngine.Color[] colors = new global::UnityEngine.Color[]
                {
                    this.color,
                    this.color,
                    this.color,
                    this.color,
                    new global::UnityEngine.Color(this.color.r, this.color.g, this.color.b, 0f),
                    new global::UnityEngine.Color(this.color.r, this.color.g, this.color.b, 0f),
                    new global::UnityEngine.Color(this.color.r, this.color.g, this.color.b, 0f),
                    new global::UnityEngine.Color(this.color.r, this.color.g, this.color.b, 0f)
                };
                global::UnityEngine.Mesh mesh = new global::UnityEngine.Mesh();
                base.GetComponent <global::UnityEngine.MeshFilter>().mesh = mesh;
                mesh.vertices  = this.vertices;
                mesh.uv        = uv;
                mesh.colors    = colors;
                mesh.triangles = triangles;
                global::UnityEngine.MeshRenderer component = base.GetComponent <global::UnityEngine.MeshRenderer>();
                component.material             = global::UnityEngine.Resources.GetBuiltinResource <global::UnityEngine.Material>("Sprites-Default.mat");
                component.reflectionProbeUsage = 0;
                component.shadowCastingMode    = 0;
                component.receiveShadows       = false;
                component.useLightProbes       = false;
            }
        }
    }