Ejemplo n.º 1
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);
            }
        }
    }