optional preview frame
This commit is contained in:
28
src/preview/PreviewConfig.h
Normal file
28
src/preview/PreviewConfig.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace RenderCadenceCompositor
|
||||
{
|
||||
constexpr double kDefaultPreviewFps = 30.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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user