10 #include <display-plugins/hmd/HmdDisplayPlugin.h>
14 #include <OVR_CAPI_GL.h>
16 #define OVRPL_DISABLED
17 #include <OVR_Platform.h>
19 #include <graphics/Geometry.h>
21 class OculusBaseDisplayPlugin :
public HmdDisplayPlugin {
22 using Parent = HmdDisplayPlugin;
24 bool isSupported()
const override;
25 bool hasAsyncReprojection()
const override {
return true; }
26 bool getSupportsAutoSwitch() override final {
return true; }
28 glm::mat4 getEyeProjection(Eye eye,
const glm::mat4& baseProjection)
const override;
29 glm::mat4 getCullingProjection(
const glm::mat4& baseProjection)
const override;
32 void resetSensors() override final;
33 bool beginFrameRender(uint32_t frameIndex) override;
34 float getTargetFrameRate()
const override {
return _hmdDesc.DisplayRefreshRate; }
36 QRectF getPlayAreaRect()
override;
37 QVector<glm::vec3> getSensorPositions()
override;
39 virtual StencilMaskMode getStencilMaskMode()
const override {
return StencilMaskMode::MESH; }
40 virtual StencilMaskMeshOperator getStencilMaskMeshOperator()
override;
43 void customizeContext()
override;
44 void uncustomizeContext()
override;
45 bool internalActivate()
override;
46 void internalDeactivate()
override;
47 void updatePresentPose()
override;
50 ovrSession _session{
nullptr };
51 ovrGraphicsLuid _luid;
52 std::array<ovrEyeRenderDesc, 2> _eyeRenderDescs;
53 std::array<ovrFovPort, 2> _eyeFovs;
55 ovrLayerEyeFov _sceneLayer;
56 ovrViewScaleDesc _viewScaleDesc;
58 bool _hmdMounted {
false };
59 bool _visible {
true };
61 std::array<graphics::MeshPointer, 2> _stencilMeshes;
62 bool _stencilMeshesInitialized {
false };