예제 #1
0
    // 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);
    }
예제 #2
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);
            }
        }
    }