public void Dispose() { if (needsShutdown) { OpenVR.Shutdown(); } }
public static bool GetBounds(Size size, ref HmdQuad_t pRect) { if (size == Size.Calibrated) { var initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport); if (initOpenVR) { var error = EVRInitError.None; OpenVR.Init(ref error, EVRApplicationType.VRApplication_Utility); } var chaperone = OpenVR.Chaperone; bool success = (chaperone != null) && chaperone.GetPlayAreaRect(ref pRect); if (!success) { Debug.LogWarning("Failed to get Calibrated Play Area bounds! Make sure you have tracking first, and that your space is calibrated."); } if (initOpenVR) { OpenVR.Shutdown(); } return(success); } else { try { var str = size.ToString().Substring(1); var arr = str.Split(new char[] { 'x' }, 2); // convert to half size in meters (from cm) var x = float.Parse(arr[0]) / 200; var z = float.Parse(arr[1]) / 200; pRect.vCorners0.v0 = x; pRect.vCorners0.v1 = 0; pRect.vCorners0.v2 = -z; pRect.vCorners1.v0 = -x; pRect.vCorners1.v1 = 0; pRect.vCorners1.v2 = -z; pRect.vCorners2.v0 = -x; pRect.vCorners2.v1 = 0; pRect.vCorners2.v2 = z; pRect.vCorners3.v0 = x; pRect.vCorners3.v1 = 0; pRect.vCorners3.v2 = z; return(true); } catch { } } return(false); }
public static void ExitTemporarySession() { if (runningTemporarySession) { OpenVR.Shutdown(); runningTemporarySession = false; } }
public static void ShowBindingsForEditor() { var initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport); if (initOpenVR) { var error = EVRInitError.None; OpenVR.Init(ref error, EVRApplicationType.VRApplication_Utility); if (error != EVRInitError.None) { Debug.LogError("[SteamVR] Error during OpenVR Init: " + error.ToString()); } } Valve.VR.EVRSettingsError bindingFlagError = Valve.VR.EVRSettingsError.None; Valve.VR.OpenVR.Settings.SetBool(Valve.VR.OpenVR.k_pch_SteamVR_Section, Valve.VR.OpenVR.k_pch_SteamVR_DebugInputBinding, true, ref bindingFlagError); if (bindingFlagError != Valve.VR.EVRSettingsError.None) { Debug.LogError("[SteamVR] Error turning on the debug input binding flag in steamvr: " + bindingFlagError.ToString()); } if (Application.isPlaying == false) { IdentifyApplication(); SteamVR_Input.IdentifyActionsFile(); } /* * GameObject tempObject = new GameObject("[Temp] [SteamVR Input]"); * SteamVR_Input.Initialize(tempObject); * * VRActiveActionSet_t[] sets = new VRActiveActionSet_t[SteamVR_Input.actionSets.Length]; * for (int setIndex = 0; setIndex < SteamVR_Input.actionSets.Length; setIndex++) * { * sets[setIndex].ulActionSet = SteamVR_Input.actionSets[setIndex].handle; * } * * EVRInputError showBindingsError = OpenVR.Input.ShowBindingsForActionSet(sets, (uint)(sets.Length * System.Runtime.InteropServices.Marshal.SizeOf(typeof(VRActiveActionSet_t))), 0); * * if (showBindingsError != EVRInputError.None) * { * Debug.LogError("Error showing bindings ui: " + showBindingsError.ToString()); * } */ if (initOpenVR) { OpenVR.Shutdown(); } Application.OpenURL("http://localhost:8998/dashboard/controllerbinding.html?app=" + SteamVR_Settings.instance.appKey.ToLower()); //todo: update with the actual call }
public override void Dispose() { if (this.context != null) { this.context.ClearState(); this.context.Flush(); } ValveOpenVR.Shutdown(); base.Dispose(); }
public override void Dispose() { _mirrorTexture.Dispose(); _leftEyeFB.ColorTargets[0].Target.Dispose(); _leftEyeFB.DepthTarget?.Target.Dispose(); _leftEyeFB.Dispose(); _rightEyeFB.ColorTargets[0].Target.Dispose(); _rightEyeFB.DepthTarget?.Target.Dispose(); _rightEyeFB.Dispose(); OVR.Shutdown(); }
public static object CallSystemFn(SystemFn fn, params object[] args) { bool initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport); if (initOpenVR) { EVRInitError error = EVRInitError.None; OpenVR.Init(ref error, EVRApplicationType.VRApplication_Utility); } CVRSystem system = OpenVR.System; object result = (system != null) ? fn(system, args) : null; if (initOpenVR) { OpenVR.Shutdown(); } return(result); }
/// <summary> /// Configures the specified windows handler. /// </summary> /// <param name="windowsHandler">The windows handler.</param> public override void Configure(IntPtr windowsHandler) { base.Configure(windowsHandler); this.LoadNativeLibrary(); var error = EVRInitError.None; this.HmdDetected = true; this.Hmd = ValveOpenVR.Init(ref error, this.OpenVRApplicationType); if (error != EVRInitError.None) { OpenVRHelper.ReportInitError(error); this.Hmd = null; this.HmdDetected = false; } // Verify common interfaces are valid. ValveOpenVR.GetGenericInterface(ValveOpenVR.IVRCompositor_Version, ref error); if (error != EVRInitError.None) { OpenVRHelper.ReportInitError(error); this.HmdDetected = false; } ValveOpenVR.GetGenericInterface(ValveOpenVR.IVROverlay_Version, ref error); if (error != EVRInitError.None) { OpenVRHelper.ReportInitError(error); this.HmdDetected = false; } if (this.Hmd == null) { ValveOpenVR.Shutdown(); return; } }
public override void Dispose() { OVR.Shutdown(); }