hachem.wtf
aboutsummaryrefslogtreecommitdiff
path: root/src/core/application.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/application.cpp')
-rw-r--r--src/core/application.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/core/application.cpp b/src/core/application.cpp
index 81051a5..e406511 100644
--- a/src/core/application.cpp
+++ b/src/core/application.cpp
@@ -12,6 +12,7 @@
#include <algorithm>
#include <thread>
#include <chrono>
+#include <cstdlib>
namespace Donut
{
@@ -75,9 +76,7 @@ namespace Donut
m_ui = create_scope<UILayer>();
m_device->init_imgui();
- ImGuiIO& io = ImGui::GetIO();
- if (!io.Fonts->AddFontFromFileTTF("assets/fonts/inter/static/Inter_18pt-Regular.ttf", 16.0f))
- io.Fonts->AddFontDefault();
+ m_ui->init();
g_prev_scroll = glfwSetScrollCallback((GLFWwindow*)m_window->get_native_window(), donut_scroll_callback);
@@ -157,6 +156,20 @@ namespace Donut
m_scene->scene_camera.set_projection(45.0f, (float)w / (float)std::max(h, 1), 0.1f, 1000.0f);
View view = m_ui->draw(UIContext{ *m_scene, m_device->device_name(), *this });
+
+ if (const char* autoexport = std::getenv("DONUT_AUTOEXPORT"))
+ {
+ static int frame = 0;
+ const int at = std::atoi(autoexport) > 0 ? std::atoi(autoexport) : 30;
+ if (++frame == at)
+ {
+ ExportConfig cfg;
+ cfg.width = 1280; cfg.height = 720;
+ int written = export_frame(cfg);
+ DONUT_INFO("autoexport wrote {} file(s)", written);
+ close();
+ }
+ }
update_input(view);
m_render_path->sync_hdri(m_scene->hdri_path);