Photon Editor Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
Application.h
Go to the documentation of this file.
1#pragma once
2
3#include "App/Editor.h"
5
6#include <Common/primitive_type.h>
7#include <Math/TVector2.h>
8
9#include <string>
10#include <memory>
11#include <vector>
12
13namespace ph { class Path; }
14
15namespace ph::editor
16{
17
18class AppSettings;
19class Platform;
20class ProcedureModule;
21class RenderModule;
22class MainThreadUpdateContext;
23class MainThreadRenderUpdateContext;
24class AppModule;
25
26class Application final
27{
28public:
29 Application(int argc, char* argv[]);
31
35 void run();
36
40 void close();
41
48 bool attachRenderModule(RenderModule* inModule);
50 bool detachRenderModule(RenderModule* inModule);
52
53private:
54 void initialRenderThreadUpdate();
55 void finalRenderThreadUpdate();
56 void runMainLoop();
57 void appStart();
58 void appUpdate(const MainThreadUpdateContext& ctx);
59 void appRenderUpdate(const MainThreadRenderUpdateContext& ctx);
60 void appCreateRenderCommands();
61 void appBeforeUpdateStage();
62 void appAfterUpdateStage();
63 void appBeforeRenderStage();
64 void appAfterRenderStage();
65 void appStop();
66 bool attachModule(AppModule* targetModule);
67 bool detachModule(AppModule* targetModule);
68 /*void postModuleAttachedEvent(AppModule* targetModule);
69 void postModuleDetachedEvent(AppModule* targetModule);*/
70
71 static Path getCoreSettingsFile();
72
73 std::shared_ptr<AppSettings> m_settings;
74 Editor m_editor;
75 RenderThread m_renderThread;
76 std::unique_ptr<Platform> m_platform;
77 std::vector<ProcedureModule*> m_procedureModules;
78 std::vector<RenderModule*> m_renderModules;
79 std::vector<AppModule*> m_modules;
80 bool m_isRunning;
81 bool m_shouldBreakMainLoop;
82 bool m_isClosing;
83};
84
85}// end namespace ph::editor
Definition AppModule.h:19
Definition Application.h:27
~Application()
Definition Application.cpp:88
bool detachProcedureModule(ProcedureModule *inModule)
Definition Application.cpp:416
void close()
Close the application. Closing an already-closed application has no effect.
Definition Application.cpp:122
bool attachRenderModule(RenderModule *inModule)
Definition Application.cpp:403
bool attachProcedureModule(ProcedureModule *inModule)
Definition Application.cpp:390
bool detachRenderModule(RenderModule *inModule)
Definition Application.cpp:431
void run()
Run the application. This call will block until the application is going to be closed.
Definition Application.cpp:99
Application(int argc, char *argv[])
Definition Application.cpp:34
Definition Editor.h:45
Definition MainThreadRenderUpdateContext.h:11
Definition MainThreadUpdateContext.h:11
Definition ProcedureModule.h:12
Definition RenderModule.h:15
Definition RenderThread.h:25
Definition ph_editor.h:10
Definition ph_editor.h:5