7 #include <QApplication>
9 #include <Core/Utils/Timer.hpp>
10 #include <Gui/TimerData/FrameTimerData.hpp>
11 #include <PluginBase/RadiumPluginInterface.hpp>
13 #include <glbinding/Version.h>
16 class QCommandLineParser;
28 class 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; }
132 uint getFrameCount()
const {
return m_frameCounter; }
134 const std::string& getExportFolderName()
const {
return m_exportFoldername; }
137 void addPluginDirectory(
const std::string& pluginDir );
139 void clearPluginDirectories();
146 virtual std::string getHelpText()
const;
148 void addRadiumMenu();
160 void updateFrameStats(
const std::vector<FrameTimerData>& );
169 virtual void engineOpenGLInitialize();
173 virtual void initializeGl();
175 void updateRadiumFrameIfNeeded() {
177 if ( !m_isAboutToQuit && m_isUpdateNeeded.load() ) radiumFrame();
178 if ( m_continuousUpdateRequest <= 0 ) {
179 m_continuousUpdateRequest.store( 0 );
180 m_isUpdateNeeded.store(
false );
182 if ( m_isAboutToQuit ) { this->exit(); }
185 bool loadFile( QString path );
186 void framesCountForStatsChanged( uint count );
187 void appNeedsToQuit();
189 void setRealFrameRate(
bool on );
190 void setRecordFrames(
bool on );
191 void setRecordTimings(
bool on );
192 void setRecordGraph(
bool on );
198 void setContinuousUpdate(
bool b ) {
199 b ? m_continuousUpdateRequest++ : m_continuousUpdateRequest--;
202 if ( m_continuousUpdateRequest > 0 ) m_isUpdateNeeded.store(
true );
204 void askForUpdate() { m_isUpdateNeeded.store(
true ); }
208 void createConnections();
214 bool loadPlugins(
const std::string& pluginsPath,
215 const QStringList& loadList,
216 const QStringList& ignoreList );
254 uint m_frameCountBeforeUpdate;
257 std::vector<FrameTimerData> m_timerData;
258 std::string m_pluginPath;
278 std::atomic_bool m_isUpdateNeeded {
true };
281 std::atomic<int> m_continuousUpdateRequest { 1 };
284 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.