10 #include <display-plugins/hmd/HmdDisplayPlugin.h>
15 #include <QtPlatformHeaders/QEGLNativeContext>
16 #include <QtAndroidExtras/QAndroidJniObject>
18 #include <gl/Context.h>
19 #include <ovr/VrHandler.h>
21 typedef struct ovrTextureSwapChain ovrTextureSwapChain;
22 typedef struct ovrMobile ovrMobile;
23 typedef struct ANativeWindow ANativeWindow;
25 class OculusMobileDisplayPlugin :
public HmdDisplayPlugin,
public ovr::VrHandler {
26 using Parent = HmdDisplayPlugin;
28 OculusMobileDisplayPlugin();
29 virtual ~OculusMobileDisplayPlugin();
30 bool isSupported()
const override {
return true; };
31 bool hasAsyncReprojection()
const override {
return true; }
32 bool getSupportsAutoSwitch() override final {
return false; }
33 QThread::Priority getPresentPriority()
override {
return QThread::TimeCriticalPriority; }
35 glm::mat4 getEyeProjection(Eye eye,
const glm::mat4& baseProjection)
const override;
36 glm::mat4 getCullingProjection(
const glm::mat4& baseProjection)
const override;
39 void resetSensors() override final;
40 bool beginFrameRender(uint32_t frameIndex) override;
42 QRectF getPlayAreaRect() override;
43 float getTargetFrameRate() const override;
45 void deinit() override;
48 const QString getName()
const override {
return NAME; }
50 bool internalActivate()
override;
51 void internalDeactivate()
override;
53 void customizeContext()
override;
54 void uncustomizeContext()
override;
56 void updatePresentPose()
override;
57 void internalPresent()
override;
58 void hmdPresent()
override {
throw std::runtime_error(
"Unused"); }
59 bool isHmdMounted()
const override;
60 bool alwaysPresent()
const override {
return true; }
62 static const char* NAME;
63 mutable gl::Context* _mainContext{
nullptr };