]> git.tdb.fi Git - libs/vr.git/blob - source/system.cpp
Remove extra blank line
[libs/vr.git] / source / system.cpp
1 #include <msp/strings/format.h>
2 #include "system.h"
3 #ifdef WITH_OPENVR
4 #include "openvr/openvrsystem.h"
5 #endif
6 #ifdef WITH_LIBOVR
7 #include "libovr/libovrsystem.h"
8 #endif
9
10 using namespace std;
11
12 namespace Msp {
13 namespace VR {
14
15 System *System::create(const string &type)
16 {
17 #ifdef WITH_OPENVR
18         if(type=="openvr")
19                 return new OpenVRSystem;
20 #endif
21 #ifdef WITH_LIBOVR
22         if(type=="libovr")
23                 return new LibOVRSystem;
24 #endif
25         throw invalid_argument(format("system '%s' not supported", type));
26 }
27
28 System *System::create_autodetect()
29 {
30 #ifdef WITH_OPENVR
31         if(OpenVRSystem::is_maybe_available())
32         {
33                 try
34                 {
35                         return new OpenVRSystem;
36                 }
37                 catch(const runtime_error &)
38                 { }
39         }
40 #endif
41
42 #ifdef WITH_LIBOVR
43         try
44         {
45                 return new LibOVRSystem;
46         }
47         catch(const runtime_error &)
48         { }
49 #endif
50
51         return 0;
52 }
53
54 void System::set_absolute_tracking(bool a)
55 {
56         if(a)
57                 throw invalid_argument("absolute tracking not supported");
58 }
59
60 MotionController *System::create_controller()
61 {
62         throw runtime_error("controller not supported");
63 }
64
65 } // namespace VR
66 } // namespace Msp