diff --git a/imgui.ini b/imgui.ini index ed64e33..b0d7623 100644 --- a/imgui.ini +++ b/imgui.ini @@ -3,6 +3,14 @@ Pos=60,60 Size=400,400 [Window][Settings] -Pos=1511,75 +Pos=1515,93 Size=368,276 +[Window][Material] +Pos=1620,199 +Size=297,259 + +[Window][Camera] +Pos=1614,5 +Size=279,183 + diff --git a/shaders/compute.glsl b/shaders/compute.glsl index 30a3f91..70ce97d 100644 --- a/shaders/compute.glsl +++ b/shaders/compute.glsl @@ -151,7 +151,7 @@ vec3 pathtrace(Ray ray, inout uint rng_state) hitInfo hit = traceRay(ray); if (hit.obj_index == -1) { - // light += GetEnvironmentLight(ray); + light += GetEnvironmentLight(ray); // light += vec3(135 / 255.0f, 206 / 255.0f, 235 / 255.0f); //ambient color break; } diff --git a/srcs/class/Window.cpp b/srcs/class/Window.cpp index 04aef6b..696f69e 100644 --- a/srcs/class/Window.cpp +++ b/srcs/class/Window.cpp @@ -171,20 +171,45 @@ void Window::imGuiRender() { bool has_changed = false; - ImGui::Begin("Settings"); + ImGui::Begin("Camera"); ImGui::Text("Fps: %d", int(_fps)); ImGui::Text("Frame: %d", _frameCount); - if (ImGui::CollapsingHeader("Camera")) - { - if (ImGui::Checkbox("Accumulate", &accumulate)) - _frameCount = 0; + ImGui::Separator(); + if (ImGui::Checkbox("Accumulate", &accumulate)) + _frameCount = 0; - has_changed |= ImGui::SliderInt("Bounce", &_scene->getCamera()->getBounce(), 0, 20); - has_changed |= ImGui::SliderFloat("FOV", &_scene->getCamera()->getFov(), 1.0f, 180.0f); - has_changed |= ImGui::SliderFloat("Aperture", &_scene->getCamera()->getAperture(), 0.0f, 1.0f); - has_changed |= ImGui::SliderFloat("Focus", &_scene->getCamera()->getFocus(), 0.0f, 150.0f); + has_changed |= ImGui::SliderInt("Bounce", &_scene->getCamera()->getBounce(), 0, 20); + has_changed |= ImGui::SliderFloat("FOV", &_scene->getCamera()->getFov(), 1.0f, 180.0f); + has_changed |= ImGui::SliderFloat("Aperture", &_scene->getCamera()->getAperture(), 0.0f, 1.0f); + has_changed |= ImGui::SliderFloat("Focus", &_scene->getCamera()->getFocus(), 0.0f, 150.0f); + + ImGui::End(); + + ImGui::Begin("Material"); + + for (unsigned int i = 0; i < _scene->getMaterialData().size(); i++) + { + GPUMaterial &mat = _scene->getMaterialData()[i]; + + ImGui::PushID(i); + + ImGui::Text("Material %d", i); + has_changed |= ImGui::ColorEdit3("Color", &mat.color[0]); + has_changed |= ImGui::SliderFloat("Emission", &mat.emission, 0.0f, 10.0f); + + if (mat.type == 1) + has_changed |= ImGui::SliderFloat("Roughness", &mat.roughness, 0.0f, 5.0f); + else + has_changed |= ImGui::SliderFloat("Roughness", &mat.roughness, 0.0f, 1.0f); + + has_changed |= ImGui::SliderFloat("Metallic", &mat.metallic, 0.0f, 1.0f); + has_changed |= ImGui::SliderInt("Type", &mat.type, 0, 1); + + ImGui::PopID(); + + ImGui::Separator(); } ImGui::End();