forked from teamnwah/openmw-tes3coop
Editor: limit FPS in 3D preview windows (feature #3641)
This commit is contained in:
parent
87d9a4ff0b
commit
f4330cf057
3 changed files with 17 additions and 0 deletions
|
@ -52,6 +52,7 @@
|
|||
Bug #4474: No fallback when getVampireHead fails
|
||||
Bug #4475: Scripted animations should not cause movement
|
||||
Feature #3276: Editor: Search- Show number of (remaining) search results and indicate a search without any results
|
||||
Feature #3641: Editor: Limit FPS in 3d preview window
|
||||
Feature #4222: 360° screenshots
|
||||
Feature #4256: Implement ToggleBorders (TB) console command
|
||||
Feature #4324: Add CFBundleIdentifier in Info.plist to allow for macOS function key shortcuts
|
||||
|
|
|
@ -201,6 +201,9 @@ void CSMPrefs::State::declare()
|
|||
declareDouble ("rotate-factor", "Free rotation factor", 0.007).setPrecision(4).setRange(0.0001, 0.1);
|
||||
|
||||
declareCategory ("Rendering");
|
||||
declareInt ("framerate-limit", "FPS limit", 60).
|
||||
setTooltip("Framerate limit in 3D preview windows. Zero value means \"unlimited\".").
|
||||
setRange(0, 10000);
|
||||
declareInt ("camera-fov", "Camera FOV", 90).setRange(10, 170);
|
||||
declareBool ("camera-ortho", "Orthographic projection for camera", false);
|
||||
declareInt ("camera-ortho-size", "Orthographic projection size parameter", 100).
|
||||
|
|
|
@ -151,6 +151,9 @@ CompositeViewer::CompositeViewer()
|
|||
|
||||
connect( &mTimer, SIGNAL(timeout()), this, SLOT(update()) );
|
||||
mTimer.start( 10 );
|
||||
|
||||
int frameRateLimit = CSMPrefs::get()["Rendering"]["framerate-limit"].toInt();
|
||||
setRunMaxFrameRate(frameRateLimit);
|
||||
}
|
||||
|
||||
CompositeViewer &CompositeViewer::get()
|
||||
|
@ -168,6 +171,12 @@ void CompositeViewer::update()
|
|||
|
||||
mSimulationTime += dt;
|
||||
frame(mSimulationTime);
|
||||
|
||||
double minFrameTime = _runMaxFrameRate > 0.0 ? 1.0 / _runMaxFrameRate : 0.0;
|
||||
if (dt < minFrameTime)
|
||||
{
|
||||
OpenThreads::Thread::microSleep(1000*1000*(minFrameTime-dt));
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------
|
||||
|
@ -376,6 +385,10 @@ void SceneWidget::settingChanged (const CSMPrefs::Setting *setting)
|
|||
{
|
||||
mOrbitCamControl->setConstRoll(setting->isTrue());
|
||||
}
|
||||
else if (*setting=="Rendering/framerate-limit")
|
||||
{
|
||||
CompositeViewer::get().setRunMaxFrameRate(setting->toInt());
|
||||
}
|
||||
else if (*setting=="Rendering/camera-fov" ||
|
||||
*setting=="Rendering/camera-ortho" ||
|
||||
*setting=="Rendering/camera-ortho-size")
|
||||
|
|
Loading…
Reference in a new issue