1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-30 07:15:32 +00:00
openmw-tes3mp/apps/openmw/mwvr/openxrsession.hpp

60 lines
1.3 KiB
C++
Raw Normal View History

#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; };
2020-02-02 16:37:43 +00:00
//! Call before updating poses
void waitFrame();
//! Update predictions
void predictNext(int extraPeriods);
OpenXRLayerStack mLayerStack{};
osg::ref_ptr<OpenXRManager> mXR;
PoseSets mPredictedPoses{};
2020-02-02 16:37:43 +00:00
bool mPredictionsReady;
};
}
#endif