Line data Source code
1 : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : * This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include <math.h>
7 :
8 : #include "prlink.h"
9 : #include "prenv.h"
10 : #include "gfxPrefs.h"
11 : #include "nsString.h"
12 : #include "mozilla/Preferences.h"
13 :
14 : #include "mozilla/gfx/Quaternion.h"
15 :
16 : #ifdef XP_WIN
17 : #include "../layers/d3d11/CompositorD3D11.h"
18 : #include "../layers/d3d11/TextureD3D11.h"
19 : #endif
20 :
21 : #include "gfxVROSVR.h"
22 :
23 : #include "mozilla/dom/GamepadEventTypes.h"
24 : #include "mozilla/dom/GamepadBinding.h"
25 :
26 : #ifndef M_PI
27 : #define M_PI 3.14159265358979323846
28 : #endif
29 :
30 : using namespace mozilla::layers;
31 : using namespace mozilla::gfx;
32 : using namespace mozilla::gfx::impl;
33 : using namespace mozilla::dom;
34 :
35 : namespace {
36 : // need to typedef functions that will be used in the code below
37 : extern "C" {
38 : typedef OSVR_ClientContext (*pfn_osvrClientInit)(
39 : const char applicationIdentifier[], uint32_t flags);
40 : typedef OSVR_ReturnCode (*pfn_osvrClientShutdown)(OSVR_ClientContext ctx);
41 : typedef OSVR_ReturnCode (*pfn_osvrClientUpdate)(OSVR_ClientContext ctx);
42 : typedef OSVR_ReturnCode (*pfn_osvrClientCheckStatus)(OSVR_ClientContext ctx);
43 : typedef OSVR_ReturnCode (*pfn_osvrClientGetInterface)(
44 : OSVR_ClientContext ctx, const char path[], OSVR_ClientInterface* iface);
45 : typedef OSVR_ReturnCode (*pfn_osvrClientFreeInterface)(
46 : OSVR_ClientContext ctx, OSVR_ClientInterface iface);
47 : typedef OSVR_ReturnCode (*pfn_osvrGetOrientationState)(
48 : OSVR_ClientInterface iface, OSVR_TimeValue* timestamp,
49 : OSVR_OrientationState* state);
50 : typedef OSVR_ReturnCode (*pfn_osvrGetPositionState)(OSVR_ClientInterface iface,
51 : OSVR_TimeValue* timestamp,
52 : OSVR_PositionState* state);
53 : typedef OSVR_ReturnCode (*pfn_osvrClientGetDisplay)(OSVR_ClientContext ctx,
54 : OSVR_DisplayConfig* disp);
55 : typedef OSVR_ReturnCode (*pfn_osvrClientFreeDisplay)(OSVR_DisplayConfig disp);
56 : typedef OSVR_ReturnCode (*pfn_osvrClientGetNumEyesForViewer)(
57 : OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount* eyes);
58 : typedef OSVR_ReturnCode (*pfn_osvrClientGetViewerEyePose)(
59 : OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye,
60 : OSVR_Pose3* pose);
61 : typedef OSVR_ReturnCode (*pfn_osvrClientGetDisplayDimensions)(
62 : OSVR_DisplayConfig disp, OSVR_DisplayInputCount displayInputIndex,
63 : OSVR_DisplayDimension* width, OSVR_DisplayDimension* height);
64 : typedef OSVR_ReturnCode (
65 : *pfn_osvrClientGetViewerEyeSurfaceProjectionClippingPlanes)(
66 : OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye,
67 : OSVR_SurfaceCount surface, double* left, double* right, double* bottom,
68 : double* top);
69 : typedef OSVR_ReturnCode (*pfn_osvrClientGetRelativeViewportForViewerEyeSurface)(
70 : OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye,
71 : OSVR_SurfaceCount surface, OSVR_ViewportDimension* left,
72 : OSVR_ViewportDimension* bottom, OSVR_ViewportDimension* width,
73 : OSVR_ViewportDimension* height);
74 : typedef OSVR_ReturnCode (*pfn_osvrClientGetViewerEyeSurfaceProjectionMatrixf)(
75 : OSVR_DisplayConfig disp, OSVR_ViewerCount viewer, OSVR_EyeCount eye,
76 : OSVR_SurfaceCount surface, float near, float far,
77 : OSVR_MatrixConventions flags, float* matrix);
78 : typedef OSVR_ReturnCode (*pfn_osvrClientCheckDisplayStartup)(
79 : OSVR_DisplayConfig disp);
80 : typedef OSVR_ReturnCode (*pfn_osvrClientSetRoomRotationUsingHead)(
81 : OSVR_ClientContext ctx);
82 : }
83 :
84 : static pfn_osvrClientInit osvr_ClientInit = nullptr;
85 : static pfn_osvrClientShutdown osvr_ClientShutdown = nullptr;
86 : static pfn_osvrClientUpdate osvr_ClientUpdate = nullptr;
87 : static pfn_osvrClientCheckStatus osvr_ClientCheckStatus = nullptr;
88 : static pfn_osvrClientGetInterface osvr_ClientGetInterface = nullptr;
89 : static pfn_osvrClientFreeInterface osvr_ClientFreeInterface = nullptr;
90 : static pfn_osvrGetOrientationState osvr_GetOrientationState = nullptr;
91 : static pfn_osvrGetPositionState osvr_GetPositionState = nullptr;
92 : static pfn_osvrClientGetDisplay osvr_ClientGetDisplay = nullptr;
93 : static pfn_osvrClientFreeDisplay osvr_ClientFreeDisplay = nullptr;
94 : static pfn_osvrClientGetNumEyesForViewer osvr_ClientGetNumEyesForViewer =
95 : nullptr;
96 : static pfn_osvrClientGetViewerEyePose osvr_ClientGetViewerEyePose = nullptr;
97 : static pfn_osvrClientGetDisplayDimensions osvr_ClientGetDisplayDimensions =
98 : nullptr;
99 : static pfn_osvrClientGetViewerEyeSurfaceProjectionClippingPlanes
100 : osvr_ClientGetViewerEyeSurfaceProjectionClippingPlanes = nullptr;
101 : static pfn_osvrClientGetRelativeViewportForViewerEyeSurface
102 : osvr_ClientGetRelativeViewportForViewerEyeSurface = nullptr;
103 : static pfn_osvrClientGetViewerEyeSurfaceProjectionMatrixf
104 : osvr_ClientGetViewerEyeSurfaceProjectionMatrixf = nullptr;
105 : static pfn_osvrClientCheckDisplayStartup osvr_ClientCheckDisplayStartup =
106 : nullptr;
107 : static pfn_osvrClientSetRoomRotationUsingHead
108 : osvr_ClientSetRoomRotationUsingHead = nullptr;
109 :
110 : bool
111 0 : LoadOSVRRuntime()
112 : {
113 : static PRLibrary* osvrUtilLib = nullptr;
114 : static PRLibrary* osvrCommonLib = nullptr;
115 : static PRLibrary* osvrClientLib = nullptr;
116 : static PRLibrary* osvrClientKitLib = nullptr;
117 : //this looks up the path in the about:config setting, from greprefs.js or modules\libpref\init\all.js
118 : nsAdoptingCString osvrUtilPath =
119 0 : mozilla::Preferences::GetCString("gfx.vr.osvr.utilLibPath");
120 : nsAdoptingCString osvrCommonPath =
121 0 : mozilla::Preferences::GetCString("gfx.vr.osvr.commonLibPath");
122 : nsAdoptingCString osvrClientPath =
123 0 : mozilla::Preferences::GetCString("gfx.vr.osvr.clientLibPath");
124 : nsAdoptingCString osvrClientKitPath =
125 0 : mozilla::Preferences::GetCString("gfx.vr.osvr.clientKitLibPath");
126 :
127 : //we need all the libs to be valid
128 0 : if ((!osvrUtilPath) || (!osvrCommonPath) || (!osvrClientPath) ||
129 0 : (!osvrClientKitPath)) {
130 0 : return false;
131 : }
132 :
133 0 : osvrUtilLib = PR_LoadLibrary(osvrUtilPath.BeginReading());
134 0 : osvrCommonLib = PR_LoadLibrary(osvrCommonPath.BeginReading());
135 0 : osvrClientLib = PR_LoadLibrary(osvrClientPath.BeginReading());
136 0 : osvrClientKitLib = PR_LoadLibrary(osvrClientKitPath.BeginReading());
137 :
138 0 : if (!osvrUtilLib) {
139 0 : printf_stderr("[OSVR] Failed to load OSVR Util library!\n");
140 0 : return false;
141 : }
142 0 : if (!osvrCommonLib) {
143 0 : printf_stderr("[OSVR] Failed to load OSVR Common library!\n");
144 0 : return false;
145 : }
146 0 : if (!osvrClientLib) {
147 0 : printf_stderr("[OSVR] Failed to load OSVR Client library!\n");
148 0 : return false;
149 : }
150 0 : if (!osvrClientKitLib) {
151 0 : printf_stderr("[OSVR] Failed to load OSVR ClientKit library!\n");
152 0 : return false;
153 : }
154 :
155 : // make sure all functions that we'll be using are available
156 : #define REQUIRE_FUNCTION(_x) \
157 : do { \
158 : *(void**) & osvr_##_x = \
159 : (void*)PR_FindSymbol(osvrClientKitLib, "osvr" #_x); \
160 : if (!osvr_##_x) { \
161 : printf_stderr("osvr" #_x " symbol missing\n"); \
162 : goto fail; \
163 : } \
164 : } while (0)
165 :
166 0 : REQUIRE_FUNCTION(ClientInit);
167 0 : REQUIRE_FUNCTION(ClientShutdown);
168 0 : REQUIRE_FUNCTION(ClientUpdate);
169 0 : REQUIRE_FUNCTION(ClientCheckStatus);
170 0 : REQUIRE_FUNCTION(ClientGetInterface);
171 0 : REQUIRE_FUNCTION(ClientFreeInterface);
172 0 : REQUIRE_FUNCTION(GetOrientationState);
173 0 : REQUIRE_FUNCTION(GetPositionState);
174 0 : REQUIRE_FUNCTION(ClientGetDisplay);
175 0 : REQUIRE_FUNCTION(ClientFreeDisplay);
176 0 : REQUIRE_FUNCTION(ClientGetNumEyesForViewer);
177 0 : REQUIRE_FUNCTION(ClientGetViewerEyePose);
178 0 : REQUIRE_FUNCTION(ClientGetDisplayDimensions);
179 0 : REQUIRE_FUNCTION(ClientGetViewerEyeSurfaceProjectionClippingPlanes);
180 0 : REQUIRE_FUNCTION(ClientGetRelativeViewportForViewerEyeSurface);
181 0 : REQUIRE_FUNCTION(ClientGetViewerEyeSurfaceProjectionMatrixf);
182 0 : REQUIRE_FUNCTION(ClientCheckDisplayStartup);
183 0 : REQUIRE_FUNCTION(ClientSetRoomRotationUsingHead);
184 :
185 : #undef REQUIRE_FUNCTION
186 :
187 0 : return true;
188 :
189 : fail:
190 0 : return false;
191 : }
192 :
193 : } // namespace
194 :
195 : mozilla::gfx::VRFieldOfView
196 0 : SetFromTanRadians(double left, double right, double bottom, double top)
197 : {
198 0 : mozilla::gfx::VRFieldOfView fovInfo;
199 0 : fovInfo.leftDegrees = atan(left) * 180.0 / M_PI;
200 0 : fovInfo.rightDegrees = atan(right) * 180.0 / M_PI;
201 0 : fovInfo.upDegrees = atan(top) * 180.0 / M_PI;
202 0 : fovInfo.downDegrees = atan(bottom) * 180.0 / M_PI;
203 0 : return fovInfo;
204 : }
205 :
206 0 : VRDisplayOSVR::VRDisplayOSVR(OSVR_ClientContext* context,
207 : OSVR_ClientInterface* iface,
208 0 : OSVR_DisplayConfig* display)
209 : : VRDisplayHost(VRDeviceType::OSVR)
210 : , m_ctx(context)
211 : , m_iface(iface)
212 0 : , m_display(display)
213 : {
214 :
215 0 : MOZ_COUNT_CTOR_INHERITED(VRDisplayOSVR, VRDisplayHost);
216 :
217 0 : mDisplayInfo.mIsConnected = true;
218 0 : mDisplayInfo.mDisplayName.AssignLiteral("OSVR HMD");
219 0 : mDisplayInfo.mCapabilityFlags = VRDisplayCapabilityFlags::Cap_None;
220 0 : mDisplayInfo.mCapabilityFlags =
221 0 : VRDisplayCapabilityFlags::Cap_Orientation | VRDisplayCapabilityFlags::Cap_Position;
222 :
223 0 : mDisplayInfo.mCapabilityFlags |= VRDisplayCapabilityFlags::Cap_External;
224 0 : mDisplayInfo.mCapabilityFlags |= VRDisplayCapabilityFlags::Cap_Present;
225 :
226 : // XXX OSVR display topology allows for more than one viewer
227 : // will assume only one viewer for now (most likely stay that way)
228 :
229 : OSVR_EyeCount numEyes;
230 0 : osvr_ClientGetNumEyesForViewer(*m_display, 0, &numEyes);
231 :
232 0 : for (uint8_t eye = 0; eye < numEyes; eye++) {
233 : double left, right, bottom, top;
234 : // XXX for now there is only one surface per eye
235 0 : osvr_ClientGetViewerEyeSurfaceProjectionClippingPlanes(
236 0 : *m_display, 0, eye, 0, &left, &right, &bottom, &top);
237 : mDisplayInfo.mEyeFOV[eye] =
238 0 : SetFromTanRadians(-left, right, -bottom, top);
239 : }
240 :
241 : // XXX Assuming there is only one display input for now
242 : // however, it's possible to have more than one (dSight with 2 HDMI inputs)
243 : OSVR_DisplayDimension width, height;
244 0 : osvr_ClientGetDisplayDimensions(*m_display, 0, &width, &height);
245 :
246 :
247 0 : for (uint8_t eye = 0; eye < numEyes; eye++) {
248 :
249 : OSVR_ViewportDimension l, b, w, h;
250 0 : osvr_ClientGetRelativeViewportForViewerEyeSurface(*m_display, 0, eye, 0, &l,
251 0 : &b, &w, &h);
252 0 : mDisplayInfo.mEyeResolution.width = w;
253 0 : mDisplayInfo.mEyeResolution.height = h;
254 : OSVR_Pose3 eyePose;
255 : // Viewer eye pose may not be immediately available, update client context until we get it
256 : OSVR_ReturnCode ret =
257 0 : osvr_ClientGetViewerEyePose(*m_display, 0, eye, &eyePose);
258 0 : while (ret != OSVR_RETURN_SUCCESS) {
259 0 : osvr_ClientUpdate(*m_ctx);
260 0 : ret = osvr_ClientGetViewerEyePose(*m_display, 0, eye, &eyePose);
261 : }
262 0 : mDisplayInfo.mEyeTranslation[eye].x = eyePose.translation.data[0];
263 0 : mDisplayInfo.mEyeTranslation[eye].y = eyePose.translation.data[1];
264 0 : mDisplayInfo.mEyeTranslation[eye].z = eyePose.translation.data[2];
265 : }
266 0 : }
267 :
268 : void
269 0 : VRDisplayOSVR::Destroy()
270 : {
271 : // destroy non-owning pointers
272 0 : m_ctx = nullptr;
273 0 : m_iface = nullptr;
274 0 : m_display = nullptr;
275 0 : }
276 :
277 : void
278 0 : VRDisplayOSVR::ZeroSensor()
279 : {
280 : // recenter pose aka reset yaw
281 0 : osvr_ClientSetRoomRotationUsingHead(*m_ctx);
282 0 : }
283 :
284 : VRHMDSensorState
285 0 : VRDisplayOSVR::GetSensorState()
286 : {
287 :
288 : //update client context before anything
289 : //this usually goes into app's mainloop
290 0 : osvr_ClientUpdate(*m_ctx);
291 :
292 0 : VRHMDSensorState result;
293 : OSVR_TimeValue timestamp;
294 :
295 : OSVR_OrientationState orientation;
296 :
297 : OSVR_ReturnCode ret =
298 0 : osvr_GetOrientationState(*m_iface, ×tamp, &orientation);
299 :
300 0 : result.timestamp = timestamp.seconds;
301 0 : result.inputFrameID = mDisplayInfo.mFrameId;
302 :
303 0 : if (ret == OSVR_RETURN_SUCCESS) {
304 0 : result.flags |= VRDisplayCapabilityFlags::Cap_Orientation;
305 0 : result.orientation[0] = orientation.data[1];
306 0 : result.orientation[1] = orientation.data[2];
307 0 : result.orientation[2] = orientation.data[3];
308 0 : result.orientation[3] = orientation.data[0];
309 : }
310 :
311 : OSVR_PositionState position;
312 0 : ret = osvr_GetPositionState(*m_iface, ×tamp, &position);
313 0 : if (ret == OSVR_RETURN_SUCCESS) {
314 0 : result.flags |= VRDisplayCapabilityFlags::Cap_Position;
315 0 : result.position[0] = position.data[0];
316 0 : result.position[1] = position.data[1];
317 0 : result.position[2] = position.data[2];
318 : }
319 :
320 0 : return result;
321 : }
322 :
323 : #if defined(XP_WIN)
324 :
325 : bool
326 : VRDisplayOSVR::SubmitFrame(TextureSourceD3D11* aSource,
327 : const IntSize& aSize,
328 : const gfx::Rect& aLeftEyeRect,
329 : const gfx::Rect& aRightEyeRect)
330 : {
331 : // XXX Add code to submit frame
332 : return false;
333 : }
334 :
335 : #endif
336 :
337 : void
338 0 : VRDisplayOSVR::StartPresentation()
339 : {
340 : // XXX Add code to start VR Presentation
341 0 : }
342 :
343 : void
344 0 : VRDisplayOSVR::StopPresentation()
345 : {
346 : // XXX Add code to end VR Presentation
347 0 : }
348 :
349 : already_AddRefed<VRSystemManagerOSVR>
350 3 : VRSystemManagerOSVR::Create()
351 : {
352 3 : MOZ_ASSERT(NS_IsMainThread());
353 :
354 3 : if (!gfxPrefs::VREnabled() || !gfxPrefs::VROSVREnabled()) {
355 3 : return nullptr;
356 : }
357 0 : if (!LoadOSVRRuntime()) {
358 0 : return nullptr;
359 : }
360 0 : RefPtr<VRSystemManagerOSVR> manager = new VRSystemManagerOSVR();
361 0 : return manager.forget();
362 : }
363 :
364 : void
365 0 : VRSystemManagerOSVR::CheckOSVRStatus()
366 : {
367 0 : if (mOSVRInitialized) {
368 0 : return;
369 : }
370 :
371 : // client context must be initialized first
372 0 : InitializeClientContext();
373 :
374 : // update client context
375 0 : osvr_ClientUpdate(m_ctx);
376 :
377 : // initialize interface and display if they are not initialized yet
378 0 : InitializeInterface();
379 0 : InitializeDisplay();
380 :
381 : // OSVR is fully initialized now
382 0 : if (mClientContextInitialized && mDisplayConfigInitialized &&
383 0 : mInterfaceInitialized) {
384 0 : mOSVRInitialized = true;
385 : }
386 : }
387 :
388 : void
389 0 : VRSystemManagerOSVR::InitializeClientContext()
390 : {
391 : // already initialized
392 0 : if (mClientContextInitialized) {
393 0 : return;
394 : }
395 :
396 : // first time creating
397 0 : if (!m_ctx) {
398 : // get client context
399 0 : m_ctx = osvr_ClientInit("com.osvr.webvr", 0);
400 : // update context
401 0 : osvr_ClientUpdate(m_ctx);
402 : // verify we are connected
403 0 : if (OSVR_RETURN_SUCCESS == osvr_ClientCheckStatus(m_ctx)) {
404 0 : mClientContextInitialized = true;
405 : }
406 : }
407 : // client context exists but not up and running yet
408 : else {
409 : // update context
410 0 : osvr_ClientUpdate(m_ctx);
411 0 : if (OSVR_RETURN_SUCCESS == osvr_ClientCheckStatus(m_ctx)) {
412 0 : mClientContextInitialized = true;
413 : }
414 : }
415 : }
416 :
417 : void
418 0 : VRSystemManagerOSVR::InitializeInterface()
419 : {
420 : // already initialized
421 0 : if (mInterfaceInitialized) {
422 0 : return;
423 : }
424 : //Client context must be initialized before getting interface
425 0 : if (mClientContextInitialized) {
426 : // m_iface will remain nullptr if no interface is returned
427 0 : if (OSVR_RETURN_SUCCESS ==
428 0 : osvr_ClientGetInterface(m_ctx, "/me/head", &m_iface)) {
429 0 : mInterfaceInitialized = true;
430 : }
431 : }
432 : }
433 :
434 : void
435 0 : VRSystemManagerOSVR::InitializeDisplay()
436 : {
437 : // display is fully configured
438 0 : if (mDisplayConfigInitialized) {
439 0 : return;
440 : }
441 :
442 : //Client context must be initialized before getting interface
443 0 : if (mClientContextInitialized) {
444 : // first time creating display object
445 0 : if (m_display == nullptr) {
446 :
447 0 : OSVR_ReturnCode ret = osvr_ClientGetDisplay(m_ctx, &m_display);
448 :
449 0 : if (ret == OSVR_RETURN_SUCCESS) {
450 0 : osvr_ClientUpdate(m_ctx);
451 : // display object may have been created but not fully startup
452 0 : if (OSVR_RETURN_SUCCESS == osvr_ClientCheckDisplayStartup(m_display)) {
453 0 : mDisplayConfigInitialized = true;
454 : }
455 : }
456 :
457 : // Typically once we get Display object, pose data is available after
458 : // clientUpdate but sometimes it takes ~ 200 ms to get
459 : // a succesfull connection, so we might have to run a few update cycles
460 : } else {
461 :
462 0 : if (OSVR_RETURN_SUCCESS == osvr_ClientCheckDisplayStartup(m_display)) {
463 0 : mDisplayConfigInitialized = true;
464 : }
465 : }
466 : }
467 : }
468 :
469 : bool
470 0 : VRSystemManagerOSVR::Init()
471 : {
472 :
473 : // OSVR server should be running in the background
474 : // It would load plugins and take care of detecting HMDs
475 0 : if (!mOSVRInitialized) {
476 0 : nsIThread* thread = nullptr;
477 0 : NS_GetCurrentThread(&thread);
478 0 : mOSVRThread = already_AddRefed<nsIThread>(thread);
479 :
480 : // initialize client context
481 0 : InitializeClientContext();
482 : // try to initialize interface
483 0 : InitializeInterface();
484 : // try to initialize display object
485 0 : InitializeDisplay();
486 : // verify all components are initialized
487 0 : CheckOSVRStatus();
488 : }
489 :
490 0 : return mOSVRInitialized;
491 : }
492 :
493 : void
494 0 : VRSystemManagerOSVR::Destroy()
495 : {
496 0 : Shutdown();
497 0 : }
498 :
499 : void
500 0 : VRSystemManagerOSVR::Shutdown()
501 : {
502 0 : if (mOSVRInitialized) {
503 0 : MOZ_ASSERT(NS_GetCurrentThread() == mOSVRThread);
504 0 : mOSVRThread = nullptr;
505 0 : mHMDInfo = nullptr;
506 0 : mOSVRInitialized = false;
507 : }
508 : // client context may not have been initialized
509 0 : if (m_ctx) {
510 0 : osvr_ClientFreeDisplay(m_display);
511 : }
512 : // osvr checks that m_ctx or m_iface are not null
513 0 : osvr_ClientFreeInterface(m_ctx, m_iface);
514 0 : osvr_ClientShutdown(m_ctx);
515 0 : }
516 :
517 : bool
518 0 : VRSystemManagerOSVR::GetHMDs(nsTArray<RefPtr<VRDisplayHost>>& aHMDResult)
519 : {
520 : // make sure context, interface and display are initialized
521 0 : CheckOSVRStatus();
522 :
523 0 : if (!Init()) {
524 0 : return false;
525 : }
526 :
527 0 : mHMDInfo = new VRDisplayOSVR(&m_ctx, &m_iface, &m_display);
528 :
529 0 : if (mHMDInfo) {
530 0 : aHMDResult.AppendElement(mHMDInfo);
531 0 : return true;
532 : }
533 0 : return false;
534 : }
535 :
536 : bool
537 0 : VRSystemManagerOSVR::GetIsPresenting()
538 : {
539 0 : if (mHMDInfo) {
540 0 : VRDisplayInfo displayInfo(mHMDInfo->GetDisplayInfo());
541 0 : return displayInfo.GetPresentingGroups() != kVRGroupNone;
542 : }
543 :
544 0 : return false;
545 : }
546 :
547 : void
548 0 : VRSystemManagerOSVR::HandleInput()
549 : {
550 0 : }
551 :
552 : void
553 0 : VRSystemManagerOSVR::VibrateHaptic(uint32_t aControllerIdx,
554 : uint32_t aHapticIndex,
555 : double aIntensity,
556 : double aDuration,
557 : uint32_t aPromiseID)
558 : {
559 0 : }
560 :
561 : void
562 0 : VRSystemManagerOSVR::StopVibrateHaptic(uint32_t aControllerIdx)
563 : {
564 0 : }
565 :
566 : void
567 0 : VRSystemManagerOSVR::GetControllers(nsTArray<RefPtr<VRControllerHost>>& aControllerResult)
568 : {
569 0 : }
570 :
571 : void
572 0 : VRSystemManagerOSVR::ScanForControllers()
573 : {
574 0 : }
575 :
576 : void
577 0 : VRSystemManagerOSVR::RemoveControllers()
578 : {
579 0 : }
|