29 lines
690 B
C++
29 lines
690 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
namespace RenderCadenceCompositor
|
|
{
|
|
constexpr double kDefaultPreviewFps = 60.0;
|
|
constexpr double kMinimumPreviewFps = 1.0;
|
|
|
|
struct PreviewWindowConfig
|
|
{
|
|
bool enabled = false;
|
|
double fps = kDefaultPreviewFps;
|
|
std::string title = "Render Cadence Preview";
|
|
};
|
|
|
|
inline double NormalizePreviewFps(double fps)
|
|
{
|
|
return fps >= kMinimumPreviewFps ? fps : kDefaultPreviewFps;
|
|
}
|
|
|
|
inline unsigned PreviewTimerIntervalMilliseconds(double fps)
|
|
{
|
|
const double normalizedFps = NormalizePreviewFps(fps);
|
|
const int intervalMilliseconds = static_cast<int>(1000.0 / normalizedFps);
|
|
return static_cast<unsigned>(intervalMilliseconds > 0 ? intervalMilliseconds : 1);
|
|
}
|
|
}
|