Overte C++ Documentation
OculusLegacyDisplayPlugin.h
1 //
2 // Created by Bradley Austin Davis on 2015/05/29
3 // Copyright 2015 High Fidelity, Inc.
4 //
5 // Distributed under the Apache License, Version 2.0.
6 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
7 //
8 #pragma once
9 
10 #include <display-plugins/hmd/HmdDisplayPlugin.h>
11 
12 #include <QTimer>
13 
14 #include <OVR_CAPI.h>
15 
16 const float TARGET_RATE_OculusLegacy = 75.0f;
17 class GLWindow;
18 
19 class OculusLegacyDisplayPlugin : public HmdDisplayPlugin {
20  using Parent = HmdDisplayPlugin;
21 public:
22  OculusLegacyDisplayPlugin();
23  bool isSupported() const override;
24  const QString getName() const override { return NAME; }
25 
26  void init() override;
27 
28  int getHmdScreen() const override;
29 
30  // Stereo specific methods
31  void resetSensors() override;
32  bool beginFrameRender(uint32_t frameIndex) override;
33 
34  float getTargetFrameRate() const override;
35 
36 protected:
37  bool internalActivate() override;
38  void internalDeactivate() override;
39 
40  void customizeContext() override;
41  void uncustomizeContext() override;
42  void hmdPresent() override;
43  bool isHmdMounted() const override { return true; }
44 
45 private:
46  static const char* NAME;
47 
48  GLWindow* _hmdWindow{ nullptr };
49  ovrHmd _hmd;
50  mutable ovrTrackingState _trackingState;
51  ovrEyeRenderDesc _eyeRenderDescs[2];
52  ovrVector3f _ovrEyeOffsets[2];
53 
54  ovrFovPort _eyeFovs[2];
55  ovrTexture _eyeTextures[2]; // FIXME - not currently in use
56  mutable int _hmdScreen { -1 };
57  bool _hswDismissed { false };
58 };
59 
60