1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 17:19:56 +00:00
openmw-tes3mp/apps/openmw/engine_vr.cpp
Mads Buvik Sandvei bdade49129 In-place turning
2020-02-23 11:02:38 +01:00

25 lines
683 B
C++

#include "engine.hpp"
#include "mwbase/environment.hpp"
#include "mwvr/openxrmanager.hpp"
#include "mwvr/openxrsession.hpp"
#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()");
mXR = new MWVR::OpenXRManager();
// Ref: https://wiki.openmw.org/index.php?title=Measurement_Units
float unitsPerYard = 64.f;
float yardsPerMeter = 0.9144f;
float unitsPerMeter = unitsPerYard / yardsPerMeter;
mEnvironment.setXRSession(new MWVR::OpenXRSession(mXR, unitsPerMeter));
mXRViewer = new MWVR::OpenXRViewer(mXR, mViewer);
}