Commit db3be8a0 authored by name expunged :3's avatar name expunged :3

Update for GLM and DearImGui

parent 2663210d
......@@ -9,6 +9,7 @@
#include <memory>
#include <string>
#include <algorithm>
#include <glm/gtc/type_ptr.hpp>
#define FOVY (glm::pi<float>() / 4.0f)
......@@ -264,7 +265,7 @@ static void DrawGUI() {
ImGui::SliderFloat("AO", &(g_SelectedMeshRef->AmbientOcclusionValue), 0.0f, 1.0f);
ImGui::Checkbox("Use Constant Albedo", &(g_SelectedMeshRef->UseAlbedoColor));
if (g_SelectedMeshRef->UseAlbedoColor)
ImGui::ColorPicker3("Albedo", g_SelectedMeshRef->AlbedoColor.data.data);
ImGui::ColorPicker3("Albedo", glm::value_ptr(g_SelectedMeshRef->AlbedoColor));
ImGui::Checkbox("Use Constant Metalness", &(g_SelectedMeshRef->UseMetalnessValue));
if (g_SelectedMeshRef->UseMetalnessValue)
ImGui::SliderFloat("Metalness", &(g_SelectedMeshRef->MetalnessValue), 0.0f, 1.0f);
......@@ -354,7 +355,7 @@ static void DrawGUI() {
/* Begin scene window. */
ImGui::SetNextWindowPos(ImVec2((float)w - 300.0f, 0.0f));
ImGui::SetNextWindowSize(ImVec2(300.0f, (float)h));
ImGui::SetNextWindowCollapsed(true, ImGuiSetCond_FirstUseEver);
ImGui::SetNextWindowCollapsed(true, ImGuiCond_FirstUseEver);
ImGui::Begin("Scene", nullptr, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoNav);
/* Select environment map. */
......@@ -381,11 +382,11 @@ static void DrawGUI() {
ImGui::Text("LIGHT");
ImGui::Checkbox("Is Directional", &g_Directional);
g_PBR->SetLightDirectional(g_Directional);
ImGui::InputFloat3("Position", g_LightPosition.data.data, 2);
ImGui::InputFloat3("Position", glm::value_ptr(g_LightPosition), 2);
g_PBR->SetLightPosition(g_LightPosition);
ImGui::InputFloat("Intensity", &g_LightIntensity, 1.0f, 5.0f, 2);
g_PBR->SetLightIntensity(g_LightIntensity);
ImGui::ColorPicker3("Color", g_LightColor.data.data);
ImGui::ColorPicker3("Color", glm::value_ptr(g_LightColor));
g_PBR->SetLightColor(g_LightColor);
ImGui::Separator();
......
#include <PBRE/Program.hxx>
#include <PBRE/MacroHelpers.hxx>
#include <glm/gtc/type_ptr.hpp>
namespace PBRE {
......@@ -228,7 +229,7 @@ namespace PBRE {
/* Set uniform values. */
glUniform1f(m_AmbientOcclusionValue, mesh.AmbientOcclusionValue);
glUniform1i(m_UseAmbientOcclusionValue, mesh.UseAmbientOcclusionValue);
glUniform3fv(m_AlbedoColor, 1, mesh.AlbedoColor.data.data);
glUniform3fv(m_AlbedoColor, 1, glm::value_ptr(mesh.AlbedoColor));
glUniform1i(m_UseAlbedoColor, mesh.UseAlbedoColor);
glUniform1f(m_MetalnessValue, mesh.MetalnessValue);
glUniform1i(m_UseMetalnessValue, mesh.UseMetalnessValue);
......@@ -269,7 +270,7 @@ namespace PBRE {
glUseProgram(m_Program);
/* Set camera position uniform. */
glUniform3fv(m_CameraPosition, 1, position.data.data);
glUniform3fv(m_CameraPosition, 1, glm::value_ptr(position));
/* Unset used program. */
glUseProgram(0);
......@@ -282,7 +283,7 @@ namespace PBRE {
glUseProgram(m_Program);
/* Set light position uniform. */
glUniform3fv(m_LightPosition, 1, position.data.data);
glUniform3fv(m_LightPosition, 1, glm::value_ptr(position));
/* Unset used program. */
glUseProgram(0);
......@@ -308,7 +309,7 @@ namespace PBRE {
glUseProgram(m_Program);
/* Set light color uniform. */
glUniform3fv(m_LightColor, 1, color.data.data);
glUniform3fv(m_LightColor, 1, glm::value_ptr(color));
/* Unset used program. */
glUseProgram(0);
......@@ -369,7 +370,7 @@ namespace PBRE {
/* Set uniform values. */
glUniform1f(m_AmbientOcclusionValue, spatial.m_Mesh->AmbientOcclusionValue);
glUniform1i(m_UseAmbientOcclusionValue, spatial.m_Mesh->UseAmbientOcclusionValue);
glUniform3fv(m_AlbedoColor, 1, spatial.m_Mesh->AlbedoColor.data.data);
glUniform3fv(m_AlbedoColor, 1, glm::value_ptr(spatial.m_Mesh->AlbedoColor));
glUniform1i(m_UseAlbedoColor, spatial.m_Mesh->UseAlbedoColor);
glUniform1f(m_MetalnessValue, spatial.m_Mesh->MetalnessValue);
glUniform1i(m_UseMetalnessValue, spatial.m_Mesh->UseMetalnessValue);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment