예제 #1
0
    public void UpdateOverlay(SteamVR vr)
    {
        if (texture != null)
        {
            var settings = new Compositor_OverlaySettings();
            settings.size = (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(Compositor_OverlaySettings));
            settings.curved = curved;
            settings.antialias = antialias;
            settings.scale = scale;
            settings.distance = distance;
            settings.alpha = alpha;
            settings.uOffset = uvOffset.x;
            settings.vOffset = uvOffset.y;
            settings.uScale = uvOffset.z;
            settings.vScale = uvOffset.w;
            settings.gridDivs = gridDivs;
            settings.gridWidth = gridWidth;
            settings.gridScale = gridScale;

            var vrcam = SteamVR_Render.Top();
            if (vrcam != null && vrcam.origin != null)
            {
                var offset = new SteamVR_Utils.RigidTransform(vrcam.origin, transform);
                offset.pos.x /= vrcam.origin.localScale.x;
                offset.pos.y /= vrcam.origin.localScale.y;
                offset.pos.z /= vrcam.origin.localScale.z;
                settings.transform = offset.ToHmdMatrix44();

                // The overlay transform is always rendered in standing space, so we transform it here
                // to seated space when using the seated universe origin in Unity.
                if (SteamVR_Render.instance.trackingSpace == TrackingUniverseOrigin.TrackingUniverseSeated)
                {
                    var seated = vr.hmd.GetSeatedZeroPoseToStandingAbsoluteTrackingPose();
                    offset = new SteamVR_Utils.RigidTransform(seated) * offset;
                    settings.transform = offset.ToHmdMatrix44();
                }
            }

            vr.compositor.SetOverlay(texture.GetNativeTexturePtr(), ref settings);
        }
        else
        {
            vr.compositor.ClearOverlay();
        }
    }
예제 #2
0
internal static extern void SteamAPI_vr_IVRCompositor_SetOverlayFromFile(IntPtr instancePtr, string pchFilePath, ref Compositor_OverlaySettings pSettings);
예제 #3
0
internal static extern void SteamAPI_vr_IVRCompositor_SetOverlayRaw(IntPtr instancePtr, IntPtr buffer, uint width, uint height, uint depth, ref Compositor_OverlaySettings pSettings);
예제 #4
0
internal static extern void SteamAPI_vr_IVRCompositor_SetOverlay(IntPtr instancePtr, IntPtr pTexture, ref Compositor_OverlaySettings pSettings);
예제 #5
0
internal static extern void SteamAPI_vr_IVRCompositor_GetOverlayDefaults(IntPtr instancePtr, ref Compositor_OverlaySettings pSettings);
예제 #6
0
 internal static extern bool VR_IVRCompositor_ComputeOverlayIntersection(IntPtr instancePtr, ref Compositor_OverlaySettings pSettings, float fAspectRatio, TrackingUniverseOrigin eOrigin, HmdVector3_t vSource, HmdVector3_t vDirection, ref HmdVector2_t pvecIntersectionUV, ref HmdVector3_t pvecIntersectionTrackingSpace);