public void TestCtor() { using (var mgr = new HMDManager()) { mgr.AttachedDevice.Should().BeNull(); var hmd = mgr.WaitForAttachedDevice(TimeSpan.FromMilliseconds(100)); hmd.Should().BeNull(); hmd = mgr.WaitForAttachedDevice(TimeSpan.FromMilliseconds(10)); hmd.Should().BeNull(); mgr.Devices.Should().BeEmpty(); } }
public void TestWithOneDeviceAttached() { using (var mgr = new HMDManager()) { if (mgr.Devices.Count == 0) return; //throw new Exception("Please attach your oculus rift to the computer"); mgr.AttachedDevice.Should().NotBeNull(); mgr.AttachedDevice.Should().BeSameAs(mgr.Devices[0]); var hmd = mgr.WaitForAttachedDevice(null); hmd.Should().BeSameAs(mgr.AttachedDevice); } }
public void Initialize() { m_hmdManager = new HMDManager(); m_hmd = m_hmdManager.AttachedDevice ?? m_hmdManager.WaitForAttachedDevice(null); HorizontalResolution = m_hmd.Info.HResolution; VerticalResolution = m_hmd.Info.VResolution; VScreenSize = m_hmd.Info.VScreenSize; EyeToScreenDistance = m_hmd.Info.EyeToScreenDistance; HScreenSize = m_hmd.Info.HScreenSize; LensSeparationDistance = m_hmd.Info.LensSeparationDistance; InterpupillaryDistance = m_hmd.Info.InterpupillaryDistance; DistortionK = m_hmd.Info.DistortionK; m_hmd.Reset(); }
public void TestWithOneDeviceAttached() { using (var mgr = new HMDManager()) { if (mgr.Devices.Count == 0) { return; } //throw new Exception("Please attach your oculus rift to the computer"); mgr.AttachedDevice.Should().NotBeNull(); mgr.AttachedDevice.Should().BeSameAs(mgr.Devices[0]); var hmd = mgr.WaitForAttachedDevice(null); hmd.Should().BeSameAs(mgr.AttachedDevice); } }
private static void Main(string[] args) { using (var mgr = new HMDManager()) { // We need to ensure that the user has attached his rift to the computer // or wait until he has done so. var hmd = mgr.AttachedDevice; if (hmd == null) { Console.WriteLine("Please attach your rift to the computer..."); hmd = mgr.WaitForAttachedDevice(null); } Console.WriteLine("Found HMD at: {0}", hmd.Info.DisplayDevice); Console.WriteLine("Manufacturer: {0}", hmd.Info.Manufacturer); hmd.Reset(); } }
public void TestDeviceAdded() { // // This test uses the dummy implementation and sends a message from another // thread that a device has been added. // using (var mgr = new HMDManager(new Dummy.Factory())) { var debug = (Dummy.DeviceManager)mgr.Manager; mgr.Devices.Count.Should().Be(0); IHMD hmdAdded = null; Action <IHMD> fn = tmp => { hmdAdded = tmp; }; mgr.DeviceAttached += fn; var sw = new Stopwatch(); sw.Start(); debug.SimulateAddOneDevice(TimeSpan.FromMilliseconds(100), false); var hmd = mgr.WaitForAttachedDevice(null); sw.Elapsed.Should().BeGreaterOrEqualTo(TimeSpan.FromMilliseconds(100)); //< Because of the way, we can be certain // The manager must have waited for the device to be attached. hmd.Should().NotBeNull(); mgr.Devices.Count.Should().Be(1); mgr.Devices[0].Should().BeSameAs(hmd); // The manager must have emitted the signal *and* passed the correct // hmd hmdAdded.Should().NotBeNull(); hmdAdded.Should().BeSameAs(hmd); // The HMD must recognize that it is currently attached hmd.IsAttached.Should().BeTrue(); // The manager must return this device, as it is currently attached mgr.AttachedDevice.Should().BeSameAs(hmd); } }
public void TestDeviceAdded() { // // This test uses the dummy implementation and sends a message from another // thread that a device has been added. // using (var mgr = new HMDManager(new Dummy.Factory())) { var debug = (Dummy.DeviceManager)mgr.Manager; mgr.Devices.Count.Should().Be(0); IHMD hmdAdded = null; Action<IHMD> fn = tmp => { hmdAdded = tmp; }; mgr.DeviceAttached += fn; var sw = new Stopwatch(); sw.Start(); debug.SimulateAddOneDevice(TimeSpan.FromMilliseconds(100), false); var hmd = mgr.WaitForAttachedDevice(null); sw.Elapsed.Should().BeGreaterOrEqualTo(TimeSpan.FromMilliseconds(100)); //< Because of the way, we can be certain // The manager must have waited for the device to be attached. hmd.Should().NotBeNull(); mgr.Devices.Count.Should().Be(1); mgr.Devices[0].Should().BeSameAs(hmd); // The manager must have emitted the signal *and* passed the correct // hmd hmdAdded.Should().NotBeNull(); hmdAdded.Should().BeSameAs(hmd); // The HMD must recognize that it is currently attached hmd.IsAttached.Should().BeTrue(); // The manager must return this device, as it is currently attached mgr.AttachedDevice.Should().BeSameAs(hmd); } }
// Token: 0x060055D8 RID: 21976 RVA: 0x001D91B4 File Offset: 0x001D75B4 public override void SetMode(VRCVrCamera.CameraMode mode) { NeckMouseRotator componentInParent = base.GetComponentInParent <NeckMouseRotator>(); if (mode != VRCVrCamera.CameraMode.Avatar) { if (mode == VRCVrCamera.CameraMode.Ui) { componentInParent.enabled = false; } } else if (HMDManager.IsHmdDetected()) { Debug.Log("HMD detecting. Disabling vertical mouise"); componentInParent.enabled = false; } else { componentInParent.enabled = true; } }
public void TestDevicesPresent() { // // This test assumes that the device has already been attached when // the HMDManager is created and verifies that it correctly queries // them. // var debug = new Dummy.DeviceManager(); var hmds = new[] {debug.CreateHMD(), debug.CreateHMD()}; debug.SetHmds(hmds); using (var mgr = new HMDManager(new Dummy.Factory(), debug)) { mgr.Devices.Count.Should().Be(2); mgr.Devices[0].Info.Should().BeSameAs(hmds[0].Info); mgr.Devices[1].Info.Should().BeSameAs(hmds[1].Info); var attached1 = mgr.AttachedDevice; var attached2 = mgr.WaitForAttachedDevice(null); attached1.Should().BeSameAs(attached2); } }
public void TestDevicesPresent() { // // This test assumes that the device has already been attached when // the HMDManager is created and verifies that it correctly queries // them. // var debug = new Dummy.DeviceManager(); var hmds = new[] { debug.CreateHMD(), debug.CreateHMD() }; debug.SetHmds(hmds); using (var mgr = new HMDManager(new Dummy.Factory(), debug)) { mgr.Devices.Count.Should().Be(2); mgr.Devices[0].Info.Should().BeSameAs(hmds[0].Info); mgr.Devices[1].Info.Should().BeSameAs(hmds[1].Info); var attached1 = mgr.AttachedDevice; var attached2 = mgr.WaitForAttachedDevice(null); attached1.Should().BeSameAs(attached2); } }
// Token: 0x0600561E RID: 22046 RVA: 0x001DA93C File Offset: 0x001D8D3C public static bool ShouldForceDisableComfortTurning() { return(!VRCApplicationSetup.IsEditor() && !HMDManager.IsHmdDetected()); }
// Token: 0x0600561D RID: 22045 RVA: 0x001DA926 File Offset: 0x001D8D26 public static bool ShouldForceGamelikeLocomotion() { return(!VRCApplicationSetup.IsEditor() && !HMDManager.IsHmdDetected()); }
// Token: 0x06005679 RID: 22137 RVA: 0x001DC916 File Offset: 0x001DAD16 private bool IsInVRMode() { return(HMDManager.IsHmdDetected()); }
public InternalMessageHandler(HMDManager manager) { _manager = manager; }
// Token: 0x06005711 RID: 22289 RVA: 0x001DFE50 File Offset: 0x001DE250 public override bool IsInVRMode() { return(HMDManager.IsHmdDetected()); }
// Token: 0x060062B0 RID: 25264 RVA: 0x00232CA0 File Offset: 0x002310A0 private void UpdateActiveCursorSet() { if (this.activeCursor == VRCUiCursorManager.CursorType.None) { this.activeCursor = VRCUiCursorManager.CursorType.Gaze; if (VRCInputManager.IsEnabled(VRCInputManager.InputMethod.Vive) && VRCInputManager.IsPresent(VRCInputManager.InputMethod.Vive)) { this.activeCursor = VRCUiCursorManager.CursorType.Hands; } if (VRCInputManager.IsEnabled(VRCInputManager.InputMethod.Hydra) && VRCInputManager.IsPresent(VRCInputManager.InputMethod.Hydra)) { this.activeCursor = VRCUiCursorManager.CursorType.Hands; } if (VRCInputManager.IsEnabled(VRCInputManager.InputMethod.Oculus) && VRCInputManager.IsPresent(VRCInputManager.InputMethod.Oculus)) { this.activeCursor = VRCUiCursorManager.CursorType.Hands; } } if (VRCInputManager.AnyKey(VRCInputManager.InputMethod.Hydra) || VRCInputManager.AnyKey(VRCInputManager.InputMethod.Vive) || VRCInputManager.AnyKey(VRCInputManager.InputMethod.Oculus)) { this.activeCursor = VRCUiCursorManager.CursorType.Hands; } else if ((VRCInputManager.AnyKey(VRCInputManager.InputMethod.Controller) || VRCInputManager.AnyKey(VRCInputManager.InputMethod.Keyboard)) && HMDManager.IsHmdDetected()) { this.activeCursor = VRCUiCursorManager.CursorType.Gaze; } else if (VRCInputManager.AnyKey(VRCInputManager.InputMethod.Mouse)) { this.activeCursor = VRCUiCursorManager.CursorType.Mouse; } }