Commit 64c4a222 authored by Johannes Braun's avatar Johannes Braun
Browse files

Fixed PT crash and added contextual ImGui class

parent 48807db0
......@@ -4,7 +4,7 @@ Size=353,64
Collapsed=0
[Scene]
Pos=1,0
Pos=-2,0
Size=302,900
Collapsed=0
......@@ -23,3 +23,8 @@ Pos=1145,532
Size=295,368
Collapsed=0
[Tesuzastduzsdoasudz]
Pos=60,60
Size=59,66
Collapsed=0
#version 450
#extension GL_ARB_bindless_texture : require
in vec2 frag_uv;
in vec4 frag_color;
uniform sampler2D gui_texture;
out vec4 out_color;
void main()
{
out_color = frag_color * texture(gui_texture, frag_uv);
}
\ No newline at end of file
#version 450
in vec2 position;
in vec2 uv;
in vec4 color;
uniform mat4 projection;
out vec2 frag_uv;
out vec4 frag_color;
void main()
{
frag_uv = uv;
frag_color = color;
gl_Position = projection * vec4(position, 0, 1);
}
......@@ -163,7 +163,7 @@ BSDFResult computeEmission(const in SampledMaterial sampled_material, const in R
BSDFResult computeBSDF(const in Material material, const in vec2 random, const in Vertex vertex, const in Ray ray_in)
{
const SampledMaterial sampled_material = material.getMaterialParameters(vertex);
// inverse incoming direction
const vec3 incoming = normalize(-ray_in.direction);
......
......@@ -118,12 +118,13 @@ bool traverseObjects(const in Scene scene, const in Ray ray, const in bool use_f
vec3 tnext = (totalStepSign + (1-2*totalStepSign) * (position - index)) * delta;
float temp_t_min = 0.f;
for(;;)
//Pseudo endless loop. If for some reason it might result in not finishing, it will finish itself after a set amount of loop dispatches.
for(int i=0; i< 2 * max(mesh.grid_linespace.grid_resolution.x, max(mesh.grid_linespace.grid_resolution.y, mesh.grid_linespace.grid_resolution.z));++i)
{
int ls_index = index.x + index.y * mesh.grid_linespace.grid_resolution.x + index.z * mesh.grid_linespace.grid_resolution.x * mesh.grid_linespace.grid_resolution.y;
if(ls_index >= mesh.grid_linespace.num_linespaces)
break;
// if(ls_index >= mesh.grid_linespace.num_linespaces)
// break;
int axis = smallestAxis(tnext);
......
......@@ -148,8 +148,8 @@ bool traverseLineSpace(const in Mesh mesh, int index, const in Ray local_ray, co
bool swapped = false;
uint line_id = lineIndex(loc, mesh, index, tmin, tmax, face_tmin, face_tmax, swapped);
if(line_id * 2 + 1 > mesh.grid_linespace.linespaces[index].line_count)
return false;
// if(line_id * 2 + 1 > mesh.grid_linespace.linespaces[index].line_count)
// return false;
Line line_near = mesh.grid_linespace.linespaces[index].lines[line_id * 2];
Line line_far = mesh.grid_linespace.linespaces[index].lines[line_id * 2 + 1];
......
......@@ -5,9 +5,7 @@
#include <core/rendering/batch_renderer.h>
#include <components/PlayerController.h>
#include <core/objects/camera.h>
#include "imgui/imgui.h"
#include "imgui/imgui_glfw.h"
#include <imgui/gui.h>
#include "util/files.h"
using namespace glare;
......
......@@ -6,6 +6,9 @@ namespace glare::core
{
std::string GLSLParser::preprocess(const fs::path& shader, const std::vector<fs::path>& include_paths)
{
if (!fs::exists(shader))
throw std::invalid_argument("Shader " + shader.string() + " not found.");
std::vector<std::string> include_paths_strings;
for (const auto& path : include_paths)
include_paths_strings.push_back(path.string());
......
......@@ -144,7 +144,6 @@ namespace glare::core
gl::setEnabled(gl::EnableParameter::eMultisample, true);
ImGui::glfw3::init(m_window.glfw(), false);
glfwMakeContextCurrent(nullptr);
}
......@@ -364,9 +363,10 @@ namespace glare::core
ImGuiIO &io = ImGui::GetIO();
if (io.WantCaptureMouse && !controls::isCursorGrabbed())
{
ImGui::glfw3::mouseButtonCallback(window, button, action, mods);
// ImGui::glfw3::mouseButtonCallback(window, button, action, mods);
//TODO improve imgui mouse button presses
//return;
context->window().gui().notifyMouseButton(button, action == GLFW_PRESS);
}
for (auto &&call : context->callbacks().m_on_mousebutton)
......@@ -380,7 +380,7 @@ namespace glare::core
ImGuiIO &io = ImGui::GetIO();
if (io.WantCaptureMouse)
{
ImGui::glfw3::scrollCallback(window, xoffset, yoffset);
context->window().gui().notifyMouseScroll(static_cast<float>(xoffset), static_cast<float>(yoffset));
return;
}
......@@ -395,7 +395,7 @@ namespace glare::core
ImGuiIO &io = ImGui::GetIO();
if (io.WantTextInput || io.WantCaptureKeyboard)
{
ImGui::glfw3::charCallback(window, character);
context->window().gui().notifyCharInput(character);
return;
}
......@@ -410,7 +410,7 @@ namespace glare::core
ImGuiIO &io = ImGui::GetIO();
if (io.WantCaptureKeyboard || io.WantTextInput)
{
ImGui::glfw3::keyCallback(window, key, scancode, action, mods);
context->window().gui().notifyKeyPress(key, scancode, action, mods);
return;
}
......
......@@ -14,7 +14,7 @@
// To enable robust buffer access on out-of-bounds accesses. glfwWindowHint(GLFW_CONTEXT_ROBUSTNESS, GLFW_NO_RESET_NOTIFICATION);
if (width * height == 0) glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
m_main_window = glfwCreateWindow(width, height, title.c_str(), nullptr, nullptr);
glfwMakeContextCurrent(m_main_window); glewExperimental = true; glewInit(); glfwMakeContextCurrent(nullptr); }
glfwMakeContextCurrent(m_main_window); glewExperimental = true; glewInit(); m_gui = std::make_unique<gui::Gui>(m_main_window); glfwMakeContextCurrent(nullptr); }
void Window::makeCurrent() const
{
......@@ -26,10 +26,10 @@
void Window::loop(loop_type loop_function) const { gl::clearColor(0, 0, 0, 0); setEnabled(gl::EnableParameter::eDepthTest); setEnabled(gl::EnableParameter::eCullFace);
glfwSwapInterval(0);
clampColor(gl::ClampColorTarget::eRead, false); cullFace(gl::Face::eBack);
while (!glfwWindowShouldClose(m_main_window)) { Time::newFrame(); ImGui::glfw3::newFrame(); clear(gl::ClearBufferBits::eColor | gl::ClearBufferBits::eDepth);
while (!glfwWindowShouldClose(m_main_window)) { Time::newFrame(); ImGui::SetCurrentContext(&m_gui->context()); m_gui->newFrame(); clear(gl::ClearBufferBits::eColor | gl::ClearBufferBits::eDepth);
loop_function();
ImGui::Render(); glfwSwapBuffers(m_main_window); glfwPollEvents(); }
ImGui::glfw3::shutdown(); glfwTerminate(); }
m_gui->render(); glfwSwapBuffers(m_main_window); glfwPollEvents(); }
ImGui::Shutdown(); glfwTerminate(); }
void Window::close() const { glfwSetWindowShouldClose(m_main_window, true); }
int Window::getKeyState(int key) const { return glfwGetKey(m_main_window, key); }
int Window::getMouseButtonState(int key) const { return glfwGetMouseButton(m_main_window, key); }
......
......@@ -4,10 +4,7 @@
//std
#include <functional>
//OpenGL
#include <GL/glew.h>
#define GLFW_INCLUDE_GLEXT
#include <GLFW/glfw3.h>
#include <imgui/gui.h>
#include <core/numeric/geometry.h>
......@@ -55,8 +52,11 @@ namespace glare
math::Rectangle windowRectangle() const;
VSync getVSync() const;
gui::Gui& gui() { return *m_gui; }
private:
GLFWwindow *m_main_window;
std::unique_ptr<gui::Gui> m_gui;
VSync m_vsync;
unsigned m_width;
unsigned m_height;
......
#include "gui.h"
#include <util/offset_of.h>
#include <core/base/gl_state.h>
#define NOMINMAX
#ifdef _WIN32
#undef APIENTRY
#define GLFW_EXPOSE_NATIVE_WIN32
#define GLFW_EXPOSE_NATIVE_WGL
#include <GLFW/glfw3native.h>
#endif
namespace gui
{
Gui::Gui(GLFWwindow* window, fs::path ini_file)
: m_window(window), m_ini_file(ini_file.string())
{
m_context = ImGui::CreateContext();
m_context->IO.IniFilename = m_ini_file.c_str();
applyTheme();
mapKeys();
addCallbacks();
}
Gui::~Gui()
{
ImGui::DestroyContext(m_context);
}
void Gui::addCallbacks()
{
auto&& io = m_context->IO;
io.UserData = this;
//io.RenderDrawListsFn = renderDrawLists; // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer.
io.SetClipboardTextFn = [](void* user_data, const char* clip) { glfwSetClipboardString(reinterpret_cast<Gui*>(user_data)->m_window, clip); };
io.GetClipboardTextFn = [](void* user_data) { return glfwGetClipboardString(reinterpret_cast<Gui*>(user_data)->m_window); };
#ifdef _WIN32
io.ImeWindowHandle = glfwGetWin32Window(m_window);
#endif
}
void Gui::initializeDrawRequirements()
{
if (static bool locker = true; locker) { locker = false; }
else { return; }
// Backup GL state
int last_texture, last_array_buffer, last_vertex_array;
gl::getIntegerv(gl::GetParameter::eTextureBinding2D, &last_texture);
gl::getIntegerv(gl::GetParameter::eArrayBufferBinding, &last_array_buffer);
gl::getIntegerv(gl::GetParameter::eVertexArrayBinding, &last_vertex_array);
std::vector<std::shared_ptr<glare::core::Shader>> m_shaders = {
std::make_shared<glare::core::Shader>(gl::ShaderType::eVertex, files::asset("shaders/imgui/imgui.vert")),
std::make_shared<glare::core::Shader>(gl::ShaderType::eFragment, files::asset("shaders/imgui/imgui.frag"))
};
m_program = std::make_unique<glare::core::Program>(m_shaders);
const int attrib_position = m_program->attributeLocation("position");
const int attrib_texcoord = m_program->attributeLocation("uv");
const int attrib_color = m_program->attributeLocation("color");
m_vertex_array.linkAttribute(m_vertex_buffer.id(), attrib_position, 2, gl::Type::eFloat, false, sizeof(ImDrawVert), offset_of(&ImDrawVert::pos));
m_vertex_array.linkAttribute(m_vertex_buffer.id(), attrib_texcoord, 2, gl::Type::eFloat, false, sizeof(ImDrawVert), offset_of(&ImDrawVert::uv));
m_vertex_array.linkAttribute(m_vertex_buffer.id(), attrib_color, 4, gl::Type::eUByte, true, sizeof(ImDrawVert), offset_of(&ImDrawVert::col));
m_vertex_array.linkIndices(m_element_buffer.id());
auto&& io = m_context->IO;
// Build texture atlas
unsigned char* pixels;
int width, height;
io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height); // Load as RGBA 32-bits for OpenGL3 demo because it is more likely to be compatible with user's existing shader.
m_font_texture = std::make_unique<glare::core::Texture>(glare::core::Texture::Target::e2D, glare::core::Texture::StoreFormat::eRGBA8);
auto params = m_font_texture->parameters();
params.filter_min = gl::TextureFilterMin::eLinear;
params.filter_mag = gl::TextureFilterMag::eLinear;
m_font_texture->set(glare::core::Texture::SubTarget::e2D, glare::core::Image<uint8_t>({ width, height }, 4, std::vector<uint8_t>(pixels, pixels + width*height * 4)), params);
// Store our identifier
io.Fonts->TexID = reinterpret_cast<void *>(static_cast<intptr_t>(m_font_texture->textureAddress()));
// Cleanup (don't clear the input data if you want to append new fonts later)
io.Fonts->ClearInputData();
io.Fonts->ClearTexData();
// Restore modified GL state
gl::bindTexture(gl::TextureType::e2D, last_texture);
gl::bindBuffer(gl::BufferType::eArray, last_array_buffer);
gl::bindVertexArray(last_vertex_array);
}
void Gui::newFrame()
{
initializeDrawRequirements();
auto&& io = m_context->IO;
// Setup display size (every frame to accommodate for window resizing)
{
int w, h;
int display_w, display_h;
glfwGetWindowSize(m_window, &w, &h);
glfwGetFramebufferSize(m_window, &display_w, &display_h);
io.DisplaySize = ImVec2(static_cast<float>(w), static_cast<float>(h));
io.DisplayFramebufferScale = ImVec2(static_cast<float>(display_w) / w, static_cast<float>(display_h) / h);
}
// Setup time step
{
static double time = 0.0;
const double current_time = glfwGetTime();
io.DeltaTime = time > 0.0 ? static_cast<float>(current_time - time) : static_cast<float>(1.0f / 60.0f);
time = current_time;
}
// Setup inputs
// (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents())
// Mouse position in screen coordinates (set to -1,-1 if no mouse / on another screen, etc.)
if (glfwGetWindowAttrib(m_window, GLFW_FOCUSED))
{
double mouse_x, mouse_y;
glfwGetCursorPos(m_window, &mouse_x, &mouse_y);
io.MousePos = ImVec2(static_cast<float>(mouse_x), static_cast<float>(mouse_y));
}
else
{
io.MousePos = ImVec2(-1, -1);
}
for (int i = 0; i < 3; i++)
{
io.MouseDown[i] = m_mouse_down[i] || glfwGetMouseButton(m_window, i) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame.
m_mouse_down[i] = false;
}
io.MouseWheel = m_scroll_y;
m_scroll_y = 0.0f;
// Start the frame
ImGui::NewFrame();
}
void Gui::render()
{
ImGui::Render();
auto draw_data = ImGui::GetDrawData();
// Backup GL state. On leaving the scope, this will be reset.
glare::core::CaptureGlState capture{};
// Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled
gl::setEnabled(gl::EnableParameter::eBlend, true);
gl::blendEquation(gl::BlendEquation::eAdd);
gl::blendFunc(gl::BlendFunc::eSrcAlpha, gl::BlendFunc::eOneMinusSrcAlpha);
gl::setEnabled(gl::EnableParameter::eCullFace, false);
gl::setEnabled(gl::EnableParameter::eDepthTest, false);
gl::setEnabled(gl::EnableParameter::eScissorTest, true);
// Handle cases of screen coordinates != from framebuffer coordinates (e.g. retina displays)
auto&& io = m_context->IO;
const float fb_height = io.DisplaySize.y * io.DisplayFramebufferScale.y;
const float fb_width = io.DisplaySize.x * io.DisplayFramebufferScale.x;
draw_data->ScaleClipRects(io.DisplayFramebufferScale);
// Setup viewport, orthographic projection matrix
gl::viewport(0, 0, static_cast<int>(fb_width), static_cast<int>(fb_height));
glm::mat4 projection = {
2.0f, 0.0f, 0.0f, 0.0f,
0.0f, -2.0f, 0.0f, 0.0f,
0.0f, 0.0f, -1.0f, 0.0f,
-1.0f, 1.0f, 0.0f, 1.0f,
};
projection[0][0] /= io.DisplaySize.x;
projection[1][1] /= io.DisplaySize.y;
m_program->use();
m_program->uniform("projection", projection);
m_vertex_array.bind();
for (int n = 0; n < draw_data->CmdListsCount; n++)
{
const ImDrawList* cmd_list = draw_data->CmdLists[n];
const ImDrawIdx* idx_buffer_offset = nullptr;
m_vertex_buffer.upload(static_cast<ptrdiff_t>(cmd_list->VtxBuffer.size()), &cmd_list->VtxBuffer.front(), gl::BufferUsage::eDynamicDraw);
m_element_buffer.upload(static_cast<ptrdiff_t>(cmd_list->IdxBuffer.size()), &cmd_list->IdxBuffer.front(), gl::BufferUsage::eDynamicDraw);
m_vertex_array.linkIndices(m_element_buffer.id());
for (const auto& pcmd : cmd_list->CmdBuffer)
{
if (pcmd.UserCallback)
{
pcmd.UserCallback(cmd_list, &pcmd);
}
else
{
// using bindless here.
m_program->uniform("gui_texture", reinterpret_cast<uint64_t>(pcmd.TextureId));
gl::scissor(static_cast<int>(pcmd.ClipRect.x), static_cast<int>(fb_height - pcmd.ClipRect.w), static_cast<unsigned>(pcmd.ClipRect.z - pcmd.ClipRect.x), static_cast<unsigned>(pcmd.ClipRect.w - pcmd.ClipRect.y));
gl::drawElements(gl::PrimitiveType::eTriangles, static_cast<unsigned>(pcmd.ElemCount), gl::Type::eUShort, idx_buffer_offset);
}
idx_buffer_offset += pcmd.ElemCount;
}
}
}
void Gui::notifyMouseScroll(float x, float y)
{
m_scroll_y += y;
}
void Gui::notifyMouseButton(int button, bool down)
{
if (down && button >= 0 && button < 3)
m_mouse_down[button] = down;
}
void Gui::notifyKeyPress(int key, int scancode, int action, int mods)
{
auto&& io = m_context->IO;
if (action == GLFW_PRESS)
io.KeysDown[key] = true;
if (action == GLFW_RELEASE)
io.KeysDown[key] = false;
io.KeyCtrl = io.KeysDown[GLFW_KEY_LEFT_CONTROL] || io.KeysDown[GLFW_KEY_RIGHT_CONTROL];
io.KeyShift = io.KeysDown[GLFW_KEY_LEFT_SHIFT] || io.KeysDown[GLFW_KEY_RIGHT_SHIFT];
io.KeyAlt = io.KeysDown[GLFW_KEY_LEFT_ALT] || io.KeysDown[GLFW_KEY_RIGHT_ALT];
}
void Gui::notifyCharInput(const int c)
{
auto&& io = m_context->IO;
if (c > 0 && c < 0x10000)
io.AddInputCharacter(static_cast<unsigned short>(c));
}
void Gui::mapKeys()
{
// Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array.
auto&& io = m_context->IO;
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT;
io.KeyMap[ImGuiKey_UpArrow] = GLFW_KEY_UP;
io.KeyMap[ImGuiKey_DownArrow] = GLFW_KEY_DOWN;
io.KeyMap[ImGuiKey_PageUp] = GLFW_KEY_PAGE_UP;
io.KeyMap[ImGuiKey_PageDown] = GLFW_KEY_PAGE_DOWN;
io.KeyMap[ImGuiKey_Home] = GLFW_KEY_HOME;
io.KeyMap[ImGuiKey_End] = GLFW_KEY_END;
io.KeyMap[ImGuiKey_Delete] = GLFW_KEY_DELETE;
io.KeyMap[ImGuiKey_Backspace] = GLFW_KEY_BACKSPACE;
io.KeyMap[ImGuiKey_Enter] = GLFW_KEY_ENTER;
io.KeyMap[ImGuiKey_Escape] = GLFW_KEY_ESCAPE;
io.KeyMap[ImGuiKey_A] = GLFW_KEY_A;
io.KeyMap[ImGuiKey_C] = GLFW_KEY_C;
io.KeyMap[ImGuiKey_V] = GLFW_KEY_V;
io.KeyMap[ImGuiKey_X] = GLFW_KEY_X;
io.KeyMap[ImGuiKey_Y] = GLFW_KEY_Y;
io.KeyMap[ImGuiKey_Z] = GLFW_KEY_Z;
}
void Gui::applyTheme()
{
m_context->IO.Fonts->AddFontFromFileTTF(files::asset("/fonts/OpenSans-Semibold.ttf").string().c_str(), 14);
auto&& style = m_context->Style;
style.WindowPadding = ImVec2(15, 15);
style.WindowRounding = 0.0f;
style.FramePadding = ImVec2(5, 5);
style.FrameRounding = 0.0f;
style.ItemSpacing = ImVec2(8, 6);
style.ItemInnerSpacing = ImVec2(4, 3);
style.IndentSpacing = 15.0f;
style.ScrollbarSize = 15.0f;
style.ScrollbarRounding = 0.0f;
style.GrabMinSize = 6.0f;
style.GrabRounding = 0.0f;
style.FramePadding = ImVec2(4.f, 4.f);
style.Colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f);
style.Colors[ImGuiCol_TextDisabled] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
style.Colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.05f, 0.07f, 0.25f);
style.Colors[ImGuiCol_ChildWindowBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
style.Colors[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
style.Colors[ImGuiCol_Border] = ImVec4(0.80f, 0.80f, 0.83f, 0.88f);
style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.92f, 0.91f, 0.88f, 0.00f);
style.Colors[ImGuiCol_FrameBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style.Colors[ImGuiCol_TitleBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(1.00f, 0.98f, 0.95f, 0.96f);
style.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
style.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
style.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
style.Colors[ImGuiCol_ComboBg] = ImVec4(0.19f, 0.18f, 0.21f, 1.00f);
style.Colors[ImGuiCol_CheckMark] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
style.Colors[ImGuiCol_SliderGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
style.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
style.Colors[ImGuiCol_Button] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
style.Colors[ImGuiCol_ButtonActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style.Colors[ImGuiCol_Header] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style.Colors[ImGuiCol_HeaderActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
style.Colors[ImGuiCol_Column] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style.Colors[ImGuiCol_ColumnHovered] = ImVec4(0.24f, 0.23f, 0.29f, 1.00f);
style.Colors[ImGuiCol_ColumnActive] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
style.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.56f, 0.56f, 0.58f, 1.00f);
style.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
style.Colors[ImGuiCol_CloseButton] = ImVec4(0.40f, 0.39f, 0.38f, 0.16f);
style.Colors[ImGuiCol_CloseButtonHovered] = ImVec4(0.40f, 0.39f, 0.38f, 0.39f);
style.Colors[ImGuiCol_CloseButtonActive] = ImVec4(0.40f, 0.39f, 0.38f, 1.00f);
style.Colors[ImGuiCol_PlotLines] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
style.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
style.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
style.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
style.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.25f, 1.00f, 0.00f, 0.43f);
style.Colors[ImGuiCol_ModalWindowDarkening] = ImVec4(1.00f, 0.98f, 0.95f, 0.73f);
}
Gui::Style& Gui::style()
{
return m_context->Style;
}
Gui::IO& Gui::io()
{
return m_context->IO;
}
Gui::Context& Gui::context()
{
return *m_context;
}
}
\ No newline at end of file
#ifndef INCLUDE_GUI_H
#define INCLUDE_GUI_H
#include "imgui.h"
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui_internal.h"
#include "imgui_orient.h"
#include <array>
#include <memory>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#include <util/files.h>
#include <util/opengl.h>
#include <core/base/shader.h>
#include <core/base/vertex_array.h>
#include <core/base/buffer.h>
#include <core/base/program.h>
#include <core/base/texture.h>
namespace gui
{