Merge branch 'main/rendor-staging' into fixes
[ryzomcore.git] / nel / src / 3d / stereo_display.cpp
blobd09e1eef8e3361ec194223f3a7eece445c6904ba
1 /**
2 * \file stereo_display.cpp
3 * \brief IStereoDisplay
4 * \date 2013-06-27 16:29GMT
5 * \author Jan Boon (Kaetemi)
6 * IStereoDisplay
7 */
9 // NeL - MMORPG Framework <https://wiki.ryzom.dev/>
10 // Copyright (C) 2013-2014 Jan BOON (Kaetemi) <jan.boon@kaetemi.be>
12 // This source file has been modified by the following contributors:
13 // Copyright (C) 2013 Thibaut GIRKA (ThibG) <thib@sitedethib.com>
15 // This program is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU Affero General Public License as
17 // published by the Free Software Foundation, either version 3 of the
18 // License, or (at your option) any later version.
20 // This program is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU Affero General Public License for more details.
25 // You should have received a copy of the GNU Affero General Public License
26 // along with this program. If not, see <http://www.gnu.org/licenses/>.
28 #include "std3d.h"
29 #include "nel/3d/stereo_display.h"
31 // STL includes
33 // NeL includes
34 // #include <nel/misc/debug.h>
36 // Project includes
37 #include "nel/3d/stereo_ovr.h"
38 #include "nel/3d/stereo_ovr_04.h"
39 #include "nel/3d/stereo_libvr.h"
40 #include "nel/3d/stereo_debugger.h"
42 using namespace std;
43 // using namespace NLMISC;
45 #ifdef DEBUG_NEW
46 #define new DEBUG_NEW
47 #endif
49 namespace NL3D {
51 IStereoDisplay::IStereoDisplay()
56 IStereoDisplay::~IStereoDisplay()
61 const char *IStereoDisplay::getLibraryName(CStereoDeviceInfo::TStereoDeviceLibrary library)
63 static const char *nel3dName = "NeL 3D";
64 static const char *ovrName = "Oculus SDK";
65 static const char *libvrName = "LibVR";
66 static const char *openhmdName = "OpenHMD";
67 switch (library)
69 case CStereoDeviceInfo::NeL3D:
70 return nel3dName;
71 case CStereoDeviceInfo::OVR:
72 return ovrName;
73 case CStereoDeviceInfo::LibVR:
74 return libvrName;
75 case CStereoDeviceInfo::OpenHMD:
76 return openhmdName;
78 nlerror("Invalid device library specified");
79 return "<InvalidDeviceLibrary>";
82 void IStereoDisplay::listDevices(std::vector<CStereoDeviceInfo> &devicesOut)
84 #ifdef HAVE_LIBOVR
85 CStereoOVR::listDevices(devicesOut);
86 #endif
87 #ifdef HAVE_LIBVR
88 CStereoLibVR::listDevices(devicesOut);
89 #endif
90 #if !FINAL_VERSION
91 CStereoDebugger::listDevices(devicesOut);
92 #endif
95 IStereoDisplay *IStereoDisplay::createDevice(const CStereoDeviceInfo &deviceInfo)
97 return deviceInfo.Factory->createDevice();
100 void IStereoDisplay::releaseUnusedLibraries()
102 #ifdef HAVE_LIBOVR
103 if (!CStereoOVR::isLibraryInUse())
104 CStereoOVR::releaseLibrary();
105 #endif
108 void IStereoDisplay::releaseAllLibraries()
110 #ifdef HAVE_LIBOVR
111 CStereoOVR::releaseLibrary();
112 #endif
115 } /* namespace NL3D */
117 /* end of file */