mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Plugins target frame rate and period.
This commit is contained in:
parent
861393910a
commit
8ae05d8490
6 changed files with 25 additions and 1 deletions
|
@ -139,7 +139,8 @@ void Basic2DWindowOpenGLDisplayPlugin::updateFramerate() {
|
|||
} else if (FRAMERATE_30 == actionText) {
|
||||
_framerateTarget = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
_inverseFrameRate = _framerateTarget ? 1.0f / (float) _framerateTarget : 1.0f / TARGET_FRAMERATE_Basic2DWindowOpenGL; // not truncated
|
||||
|
||||
int newInterval = getDesiredInterval();
|
||||
qDebug() << newInterval;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "WindowOpenGLDisplayPlugin.h"
|
||||
|
||||
#define TARGET_FRAMERATE_Basic2DWindowOpenGL 60.0f
|
||||
|
||||
class QScreen;
|
||||
class Basic2DWindowOpenGLDisplayPlugin : public WindowOpenGLDisplayPlugin {
|
||||
Q_OBJECT
|
||||
|
@ -16,6 +18,9 @@ class Basic2DWindowOpenGLDisplayPlugin : public WindowOpenGLDisplayPlugin {
|
|||
public:
|
||||
virtual const QString & getName() const override;
|
||||
|
||||
virtual float getTargetFrameRate() { return _framerateTarget ? (float) _framerateTarget : TARGET_FRAMERATE_Basic2DWindowOpenGL; }
|
||||
virtual float getTargetFramePeriod() { return _inverseFrameRate; }
|
||||
|
||||
virtual void activate() override;
|
||||
virtual void deactivate() override;
|
||||
|
||||
|
@ -33,4 +38,5 @@ private:
|
|||
QScreen* getFullscreenTarget();
|
||||
uint32_t _framerateTarget{ 0 };
|
||||
int _fullscreenTarget{ -1 };
|
||||
float _inverseFrameRate{ 1.0f }; //seconds
|
||||
};
|
||||
|
|
|
@ -14,12 +14,17 @@
|
|||
|
||||
#include "../WindowOpenGLDisplayPlugin.h"
|
||||
|
||||
#define TARGET_RATE_OpenVr 90.0f; // FIXME: get from sdk tracked device property? This number is vive-only.
|
||||
|
||||
class OpenVrDisplayPlugin : public WindowOpenGLDisplayPlugin {
|
||||
public:
|
||||
virtual bool isSupported() const override;
|
||||
virtual const QString & getName() const override;
|
||||
virtual bool isHmd() const override { return true; }
|
||||
|
||||
virtual float getTargetFrameRate() { return TARGET_RATE_OpenVr; }
|
||||
virtual float getTargetFramePeriod() { return 1.0f / TARGET_RATE_OpenVr; }
|
||||
|
||||
virtual void activate() override;
|
||||
virtual void deactivate() override;
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ public:
|
|||
/// By default, all HMDs are stereo
|
||||
virtual bool isStereo() const { return isHmd(); }
|
||||
virtual bool isThrottled() const { return false; }
|
||||
virtual float getTargetFrameRate() { return 0.0f; }
|
||||
virtual float getTargetFramePeriod() { return 0.0f; }
|
||||
|
||||
// Rendering support
|
||||
|
||||
|
|
|
@ -12,12 +12,17 @@
|
|||
struct SwapFramebufferWrapper;
|
||||
using SwapFboPtr = QSharedPointer<SwapFramebufferWrapper>;
|
||||
|
||||
#define TARGET_RATE_Oculus 75.0f;
|
||||
|
||||
class OculusDisplayPlugin : public OculusBaseDisplayPlugin {
|
||||
public:
|
||||
virtual void activate() override;
|
||||
virtual void deactivate() override;
|
||||
virtual const QString & getName() const override;
|
||||
|
||||
virtual float getTargetFrameRate() { return TARGET_RATE_Oculus; }
|
||||
virtual float getTargetFramePeriod() { return 1.0f / TARGET_RATE_Oculus; }
|
||||
|
||||
protected:
|
||||
virtual void display(GLuint finalTexture, const glm::uvec2& sceneSize) override;
|
||||
virtual void customizeContext() override;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include <OVR_CAPI.h>
|
||||
|
||||
#define TARGET_RATE_OculusLegacy 75.0f;
|
||||
|
||||
class OculusLegacyDisplayPlugin : public WindowOpenGLDisplayPlugin {
|
||||
public:
|
||||
OculusLegacyDisplayPlugin();
|
||||
|
@ -25,6 +27,9 @@ public:
|
|||
virtual bool eventFilter(QObject* receiver, QEvent* event) override;
|
||||
virtual int getHmdScreen() const override;
|
||||
|
||||
virtual float getTargetFrameRate() { return TARGET_RATE_OculusLegacy; }
|
||||
virtual float getTargetFramePeriod() { return 1.0f / TARGET_RATE_OculusLegacy; }
|
||||
|
||||
// Stereo specific methods
|
||||
virtual bool isHmd() const override { return true; }
|
||||
virtual glm::mat4 getProjection(Eye eye, const glm::mat4& baseProjection) const override;
|
||||
|
|
Loading…
Reference in a new issue