9#include <Core/Utils/Timer.hpp>
10#include <Gui/TimerData/FrameTimerData.hpp>
11#include <PluginBase/RadiumPluginInterface.hpp>
13#include <glbinding/Version.h>
16class QCommandLineParser;
28class MainWindowInterface;
39 WindowFactory() =
default;
40 virtual ~WindowFactory() =
default;
56 QString applicationName =
"RadiumEngine",
57 QString organizationName =
"STORM-IRIT" );
96 void initialize(
const WindowFactory& factory,
const glbinding::Version& glVersion = { 4, 1 } );
109 virtual void engineBaseInitialization();
128 bool isRunning()
const {
return !m_isAboutToQuit; }
131 Viewer* getViewer() {
return m_viewer; }
133 uint getFrameCount()
const {
return m_frameCounter; }
135 const std::string& getExportFolderName()
const {
return m_exportFoldername; }
138 void addPluginDirectory(
const std::string& pluginDir );
140 void clearPluginDirectories();
149 void addRadiumMenu();
170 virtual void engineOpenGLInitialize();
174 virtual void initializeGl();
176 void updateRadiumFrameIfNeeded() {
178 if ( !m_isAboutToQuit && m_isUpdateNeeded.load() ) radiumFrame();
179 if ( m_continuousUpdateRequest <= 0 ) {
180 m_continuousUpdateRequest.store( 0 );
181 m_isUpdateNeeded.store(
false );
183 if ( m_isAboutToQuit ) { this->exit(); }
186 bool loadFile( QString path );
187 void framesCountForStatsChanged( uint count );
188 void appNeedsToQuit();
190 void setRealFrameRate(
bool on );
191 void setRecordFrames(
bool on );
192 void setRecordTimings(
bool on );
193 void setRecordGraph(
bool on );
199 void setContinuousUpdate(
bool b ) {
200 b ? m_continuousUpdateRequest++ : m_continuousUpdateRequest--;
203 if ( m_continuousUpdateRequest > 0 ) m_isUpdateNeeded.store(
true );
205 void askForUpdate() { m_isUpdateNeeded.store(
true ); }
209 void createConnections();
216 const QStringList& loadList,
217 const QStringList& ignoreList );
255 uint m_frameCountBeforeUpdate;
279 std::atomic_bool m_isUpdateNeeded {
true };
285 QCommandLineParser* m_parser;
This class contains the main application logic. It owns the engine and the GUI.
std::unique_ptr< Gui::MainWindowInterface > m_mainWindow
Application main window and GUI root class.
void sceneChanged(const Core::Aabb &)
Fired when the scene has changed.
bool m_recordGraph
If true, print the task graph;.
Engine::RadiumEngine * m_engine
Instance of the radium engine.
bool m_recordFrames
If true, dump each frame to a PNG file.
virtual void addApplicationExtension()
bool isUpdateNeeded()
check wheter someone ask for update
std::unique_ptr< Core::TaskQueue > m_taskQueue
Task queue for processing tasks.
std::map< std::string, std::string > m_loadedPlugins
maps name and paths of already loaded plugins
void setIsUpdateNeeded(bool b)
if b is true, then update anyway. If b is false, update on request only
bool m_recordTimings
If true, print the detailed timings of each frame.
QTimer * m_frameTimer
Timer to wake us up at every frame start.
Core::Utils::TimePoint m_lastFrameStart
Time since the last frame start.
uint m_targetFPS
Number of frames per second to generate.
void stopping()
Fired when the engine is about to stop.
std::vector< Ra::Plugins::RadiumPluginInterface * > m_openGLPlugins
Plugins that need to be initialized once OpenGL is ready.
bool m_realFrameRate
If true, use the wall clock to advance the engine. If false, use a fixed time step.
bool m_isAboutToQuit
True if the applicatioon is about to quit. prevent to use resources that are being released.
Gui::Viewer * m_viewer
Pointer to OpenGL Viewer for render call (belongs to MainWindow).
void starting()
Fired when the engine has just started, before the frame timer is set.
std::string m_exportFoldername
Name of the folder where exported data goes.
Data passed to the plugin constructor.
hepler function to manage enum as underlying types in VariableSet