~ | Imgui material

This commit is contained in:
TheRedShip
2025-01-12 18:30:31 +01:00
parent 7bf9037562
commit 5d5c9d432e
3 changed files with 44 additions and 11 deletions

View File

@ -3,6 +3,14 @@ Pos=60,60
Size=400,400 Size=400,400
[Window][Settings] [Window][Settings]
Pos=1511,75 Pos=1515,93
Size=368,276 Size=368,276
[Window][Material]
Pos=1620,199
Size=297,259
[Window][Camera]
Pos=1614,5
Size=279,183

View File

@ -151,7 +151,7 @@ vec3 pathtrace(Ray ray, inout uint rng_state)
hitInfo hit = traceRay(ray); hitInfo hit = traceRay(ray);
if (hit.obj_index == -1) if (hit.obj_index == -1)
{ {
// light += GetEnvironmentLight(ray); light += GetEnvironmentLight(ray);
// light += vec3(135 / 255.0f, 206 / 255.0f, 235 / 255.0f); //ambient color // light += vec3(135 / 255.0f, 206 / 255.0f, 235 / 255.0f); //ambient color
break; break;
} }

View File

@ -171,20 +171,45 @@ void Window::imGuiRender()
{ {
bool has_changed = false; bool has_changed = false;
ImGui::Begin("Settings"); ImGui::Begin("Camera");
ImGui::Text("Fps: %d", int(_fps)); ImGui::Text("Fps: %d", int(_fps));
ImGui::Text("Frame: %d", _frameCount); ImGui::Text("Frame: %d", _frameCount);
if (ImGui::CollapsingHeader("Camera")) ImGui::Separator();
{ if (ImGui::Checkbox("Accumulate", &accumulate))
if (ImGui::Checkbox("Accumulate", &accumulate)) _frameCount = 0;
_frameCount = 0;
has_changed |= ImGui::SliderInt("Bounce", &_scene->getCamera()->getBounce(), 0, 20); 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("FOV", &_scene->getCamera()->getFov(), 1.0f, 180.0f);
has_changed |= ImGui::SliderFloat("Aperture", &_scene->getCamera()->getAperture(), 0.0f, 1.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::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(); ImGui::End();