22 AppInterface(
int threadCount,
int msaa_samples, std::string openFile,
23 double initialTimestamp,
26 std::array<float, 4> bg,
32 void enqueueRenderCommand(std::function<
void()> cmd);
33 void waitForRenderCommand();
35 void waitForRenderThreadExit();
37 void RenderThreadFunc();
40 virtual void onInit() = 0;
41 virtual void addScenes() = 0;
42 virtual void onExit() = 0;
44 void onSDLEvent(SDL_Event& evnt);
50 AudioEngine& getAudioEngine() {
return _audioEngine; }
56 double initialTimestamp;
58 bool usePython =
false;
59 std::array<float, 4> backgroundColor;
62 std::condition_variable initCommandCV;
65 std::atomic<int> activeIndex = 0;
69 std::condition_variable initCV;
70 std::atomic<bool> initCommandReady{
false };
71 std::atomic<bool> initCommandComplete{
false };
73 std::vector<SDL_Event> imguiEvents;
74 std::mutex imguiEventsMutex;
89 void drawPlaneColorBatch(
94 void drawPlaneModelBatch(
105 void drawBatch(
const std::vector<Entity*>& entities,
LineRenderer& batch);
108 void drawBatch(
const std::vector<Entity*>& entities,
LightRenderer& batch);
119 virtual void checkInput();
120 virtual void update(
float deltaTime);
122 virtual void prepareDraw(
int index);
123 virtual void renderDraw(
int index);
125 virtual void updateUI(
float deltaTime);
126 virtual void drawUI();
128 void disposeRenderers(
int index);
130 virtual void swapBuffer();
133 void initRenderers();
139 std::unique_ptr<SceneList> _sceneList =
nullptr;
140 bool _isRunning =
false;
142 const float SCALE_SPEED = 0.1f;
144 std::thread renderThread;