Merge branch 'main' into feature/3-mesh-tessellation

This commit is contained in:
Jack 2024-08-28 21:20:02 -04:00
commit 9fa18ac69e
36 changed files with 35 additions and 8 deletions

View File

@ -19,7 +19,7 @@ Collapsed=0
[Window][TerraVisor]
Pos=0,0
Size=1280,946
Size=2880,1676
Collapsed=0
[Window][Scene Window]
@ -29,21 +29,21 @@ Collapsed=0
DockId=0x00000003,0
[Window][Viewport]
Pos=0,19
Size=862,927
Pos=0,34
Size=2134,1641
Collapsed=0
DockId=0x00000003,0
[Window][Scene Settings]
Pos=864,19
Size=416,927
Pos=2137,34
Size=743,1641
Collapsed=0
DockId=0x00000004,0
[Docking][Data]
DockSpace ID=0x6F42A598 Window=0xE80F322C Pos=0,19 Size=1280,927 Split=X Selected=0x9F2D9299
DockSpace ID=0x6F42A598 Window=0xE80F322C Pos=0,34 Size=2880,1641 Split=X Selected=0x9F2D9299
DockNode ID=0x00000001 Parent=0x6F42A598 SizeRef=0,0 Split=X Selected=0x13926F0B
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=862,701 CentralNode=1 Selected=0x13926F0B
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=416,701 Selected=0x413E6147
DockNode ID=0x00000003 Parent=0x00000001 SizeRef=2134,701 CentralNode=1 Selected=0x13926F0B
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=743,701 Selected=0x413E6147
DockNode ID=0x00000002 Parent=0x6F42A598 SizeRef=419,701 Selected=0xF69494A7

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,7 @@
#ifndef INTERFACE_H_
#define INTERFACE_H_
#include <GLFW/glfw3.h>
#include <imgui.h>
#include <string>
#include <vector>
@ -19,6 +20,7 @@ struct Window {
};
namespace Interface {
void ApplyUIScaling(GLFWwindow* window);
void AddWindow(std::vector<Window>& windows, const std::string& name, std::function<void()> renderFunc);
Window* GetWindowByName(std::vector<Window>& windows, const std::string& name);
void RenderWindows(std::vector<Window>& windows);

View File

@ -4,9 +4,32 @@
#include <imgui_impl_opengl3.h>
#include <algorithm>
#include <iostream>
#include <filesystem>
namespace Interface {
void ApplyUIScaling(GLFWwindow* window) {
float xScale, yScale;
glfwGetWindowContentScale(window, &xScale, &yScale);
float scale = (xScale + yScale) * 0.5f;
ImGui::GetIO().FontGlobalScale = scale;
ImGuiStyle& style = ImGui::GetStyle();
style.ScaleAllSizes(scale);
ImGuiIO& io = ImGui::GetIO();
io.Fonts->Clear();
std::cout << "Current Path: " << std::filesystem::current_path() << std::endl;
#ifdef _WIN32
io.Fonts->AddFontFromFileTTF("imgui/misc/fonts/JetBrainsMono/JetBrainsMono-Medium.ttf", 8.0f * scale);
#else
io.Fonts->AddFontFromFileTTF("../imgui/misc/fonts/JetBrainsMono/JetBrainsMono-Medium.ttf", 8.0f * scale);
#endif
io.Fonts->Build();
}
void AddWindow(std::vector<Window>& windows, const std::string& name, std::function<void()> renderFunc) {
windows.emplace_back(name, renderFunc);
}

View File

@ -42,6 +42,7 @@
#include "config.h"
#include "callbacks.h"
#include "scene.h"
#include "interface.h"
namespace {
@ -156,6 +157,7 @@ int main() {
scene.Init();
InitializeImGui(window);
FreeImage_Initialise();
Interface::ApplyUIScaling(window);
// Check if we're in test mode
const char* testEnv = std::getenv("TEST_MODE");