2020-01-09 23:10:09 +00:00
|
|
|
#include "engine.hpp"
|
|
|
|
#include "mwvr/openxrmanager.hpp"
|
2020-02-15 19:01:11 +00:00
|
|
|
#include "mwvr/openxrsession.hpp"
|
2020-02-29 22:53:56 +00:00
|
|
|
#include "mwvr/openxrviewer.hpp"
|
2020-03-01 11:54:32 +00:00
|
|
|
#include "mwvr/openxrmenu.hpp"
|
2020-01-09 23:10:09 +00:00
|
|
|
|
|
|
|
#ifndef USE_OPENXR
|
|
|
|
#error "USE_OPENXR not defined"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void OMW::Engine::initVr()
|
|
|
|
{
|
|
|
|
if (!mViewer)
|
|
|
|
throw std::logic_error("mViewer must be initialized before calling initVr()");
|
|
|
|
|
2020-02-29 22:53:56 +00:00
|
|
|
mXrEnvironment.setManager(new MWVR::OpenXRManager);
|
2020-02-14 21:11:19 +00:00
|
|
|
|
|
|
|
// Ref: https://wiki.openmw.org/index.php?title=Measurement_Units
|
|
|
|
float unitsPerYard = 64.f;
|
|
|
|
float yardsPerMeter = 0.9144f;
|
|
|
|
float unitsPerMeter = unitsPerYard / yardsPerMeter;
|
2020-02-29 22:53:56 +00:00
|
|
|
mXrEnvironment.setUnitsPerMeter(unitsPerMeter);
|
|
|
|
mXrEnvironment.setSession(new MWVR::OpenXRSession());
|
|
|
|
mXrEnvironment.setViewer(new MWVR::OpenXRViewer(mViewer));
|
2020-01-09 23:10:09 +00:00
|
|
|
}
|