1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-29 04:15:31 +00:00
openmw-tes3mp/apps/openmw/mwvr/openxrsession.hpp
Mads Buvik Sandvei e948b686e8 some cleanup
2020-02-02 17:37:43 +01:00

59 lines
1.3 KiB
C++

#ifndef MWVR_OPENRXSESSION_H
#define MWVR_OPENRXSESSION_H
#include <memory>
#include <mutex>
#include <array>
#include <chrono>
#include <deque>
#include <components/debug/debuglog.hpp>
#include <components/sdlutil/sdlgraphicswindow.hpp>
#include <components/settings/settings.hpp>
#include "openxrmanager.hpp"
#include "openxrlayer.hpp"
namespace MWVR
{
using PoseSet = std::array<Pose, 2>;
struct PoseSets
{
PoseSet eye[2]{};
PoseSet hands[2]{};
PoseSet head{};
};
class OpenXRSession
{
using seconds = std::chrono::duration<double>;
using nanoseconds = std::chrono::nanoseconds;
using clock = std::chrono::steady_clock;
using time_point = clock::time_point;
public:
OpenXRSession(osg::ref_ptr<OpenXRManager> XR);
~OpenXRSession();
void setLayer(OpenXRLayerStack::Layer layerType, OpenXRLayer* layer);
void swapBuffers(osg::GraphicsContext* gc);
PoseSets& predictedPoses() { return mPredictedPoses; };
//! Call before updating poses
void waitFrame();
//! Update predictions
void predictNext(int extraPeriods);
OpenXRLayerStack mLayerStack{};
osg::ref_ptr<OpenXRManager> mXR;
PoseSets mPredictedPoses{};
bool mPredictionsReady;
};
}
#endif