mirror of
https://github.com/overte-org/overte.git
synced 2025-07-05 23:49:28 +02:00
Add menu item, Developer > Render > Throttle FPS If Not Focus
This commit is contained in:
parent
084a098420
commit
d0489bf2a0
5 changed files with 18 additions and 3 deletions
|
@ -338,6 +338,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_lastNackTime(usecTimestampNow()),
|
||||
_lastSendDownstreamAudioStats(usecTimestampNow()),
|
||||
_isVSyncOn(true),
|
||||
_isThrottleFPSEnabled(true),
|
||||
_aboutToQuit(false),
|
||||
_notifiedPacketVersionMismatchThisDomain(false),
|
||||
_domainConnectionRefusals(QList<QString>()),
|
||||
|
@ -4612,6 +4613,10 @@ void Application::setVSyncEnabled() {
|
|||
#endif
|
||||
}
|
||||
|
||||
void Application::setThrottleFPSEnabled() {
|
||||
_isThrottleFPSEnabled = Menu::getInstance()->isOptionChecked(MenuOption::ThrottleFPSIfNotFocus);
|
||||
}
|
||||
|
||||
bool Application::isVSyncOn() const {
|
||||
#if defined(Q_OS_WIN)
|
||||
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||
|
|
|
@ -422,6 +422,9 @@ public slots:
|
|||
|
||||
void setVSyncEnabled();
|
||||
|
||||
void setThrottleFPSEnabled();
|
||||
bool isThrottleFPSEnabled() { return _isThrottleFPSEnabled; }
|
||||
|
||||
void resetSensors();
|
||||
void setActiveFaceTracker();
|
||||
void toggleFaceTrackerMute();
|
||||
|
@ -637,6 +640,7 @@ private:
|
|||
quint64 _lastSendDownstreamAudioStats;
|
||||
|
||||
bool _isVSyncOn;
|
||||
bool _isThrottleFPSEnabled;
|
||||
|
||||
bool _aboutToQuit;
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@ void GLCanvas::stopFrameTimer() {
|
|||
}
|
||||
|
||||
bool GLCanvas::isThrottleRendering() const {
|
||||
return _throttleRendering || Application::getInstance()->getWindow()->isMinimized();
|
||||
return (_throttleRendering
|
||||
|| (Application::getInstance()->getWindow()->isMinimized() && Application::getInstance()->isThrottleFPSEnabled()));
|
||||
}
|
||||
|
||||
int GLCanvas::getDeviceWidth() const {
|
||||
|
@ -59,7 +60,8 @@ void GLCanvas::initializeGL() {
|
|||
|
||||
void GLCanvas::paintGL() {
|
||||
PROFILE_RANGE(__FUNCTION__);
|
||||
if (!_throttleRendering && !Application::getInstance()->getWindow()->isMinimized()) {
|
||||
if (!_throttleRendering
|
||||
&& (!Application::getInstance()->getWindow()->isMinimized()) || !Application::getInstance()->isThrottleFPSEnabled()) {
|
||||
Application::getInstance()->paintGL();
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +87,8 @@ void GLCanvas::activeChanged(Qt::ApplicationState state) {
|
|||
|
||||
default:
|
||||
// Otherwise, throttle.
|
||||
if (!_throttleRendering && !Application::getInstance()->isAboutToQuit()) {
|
||||
if (!_throttleRendering && !Application::getInstance()->isAboutToQuit()
|
||||
&& Application::getInstance()->isThrottleFPSEnabled()) {
|
||||
_frameTimer.start(_idleRenderInterval);
|
||||
_throttleRendering = true;
|
||||
}
|
||||
|
|
|
@ -373,6 +373,8 @@ Menu::Menu() {
|
|||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::RenderTargetFramerateVSyncOn, 0, true,
|
||||
qApp, SLOT(setVSyncEnabled()));
|
||||
#endif
|
||||
addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::ThrottleFPSIfNotFocus, 0, true,
|
||||
qApp, SLOT(setThrottleFPSEnabled()));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -280,6 +280,7 @@ namespace MenuOption {
|
|||
const QString SuppressShortTimings = "Suppress Timings Less than 10ms";
|
||||
const QString TestPing = "Test Ping";
|
||||
const QString ThirdPerson = "Third Person";
|
||||
const QString ThrottleFPSIfNotFocus = "Throttle FPS If Not Focus";
|
||||
const QString ToolWindow = "Tool Window";
|
||||
const QString TransmitterDrive = "Transmitter Drive";
|
||||
const QString TurnWithHead = "Turn using Head";
|
||||
|
|
Loading…
Reference in a new issue