コード例 #1
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);
        }
    }
コード例 #2
0
    // Token: 0x0600004B RID: 75 RVA: 0x00003954 File Offset: 0x00001B54
    private void Awake()
    {
        this.meshFilter = base.GetComponent <global::UnityEngine.MeshFilter>();
        bool flag = global::SteamVR_CameraMask.material == null;

        if (flag)
        {
            global::SteamVR_CameraMask.material = new global::UnityEngine.Material(global::EscalationVR.UnityHelper.GetShader("Custom/SteamVR_HiddenArea"));
        }
        global::UnityEngine.MeshRenderer component = base.GetComponent <global::UnityEngine.MeshRenderer>();
        component.material             = global::SteamVR_CameraMask.material;
        component.shadowCastingMode    = 0;
        component.receiveShadows       = false;
        component.useLightProbes       = false;
        component.reflectionProbeUsage = 0;
    }
コード例 #3
0
    // Token: 0x060000C4 RID: 196 RVA: 0x00008A94 File Offset: 0x00006C94
    private void OnHideRenderModels(params object[] args)
    {
        bool flag = (bool)args[0];

        global::UnityEngine.MeshRenderer component = base.GetComponent <global::UnityEngine.MeshRenderer>();
        bool flag2 = component != null;

        if (flag2)
        {
            component.enabled = !flag;
        }
        foreach (global::UnityEngine.MeshRenderer meshRenderer in base.transform.GetComponentsInChildren <global::UnityEngine.MeshRenderer>())
        {
            meshRenderer.enabled = !flag;
        }
    }
コード例 #4
0
    // Token: 0x060000CC RID: 204 RVA: 0x000092A8 File Offset: 0x000074A8
    private void StripMesh(global::UnityEngine.GameObject go)
    {
        global::UnityEngine.MeshRenderer component = go.GetComponent <global::UnityEngine.MeshRenderer>();
        bool flag = component != null;

        if (flag)
        {
            global::UnityEngine.Object.DestroyImmediate(component);
        }
        global::UnityEngine.MeshFilter component2 = go.GetComponent <global::UnityEngine.MeshFilter>();
        bool flag2 = component2 != null;

        if (flag2)
        {
            global::UnityEngine.Object.DestroyImmediate(component2);
        }
    }
コード例 #5
0
 // Token: 0x0600024C RID: 588 RVA: 0x0000E71C File Offset: 0x0000C91C
 public void AssignDefaultShader()
 {
     global::UnityEngine.MeshRenderer component = base.gameObject.GetComponent <global::UnityEngine.MeshRenderer>();
     component.sharedMaterial       = new global::UnityEngine.Material(global::UnityEngine.Shader.Find("Unlit/Texture"));
     component.sharedMaterial.color = global::UnityEngine.Color.white;
 }
コード例 #6
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;
            }
        }
    }