Overhaul lighting and render debug menus
This commit is contained in:
parent
998c6f8bc2
commit
aac9e673ad
1 changed files with 57 additions and 55 deletions
|
@ -55,10 +55,7 @@ void draw_lighting() {
|
||||||
if(engine->get_scene() != nullptr) {
|
if(engine->get_scene() != nullptr) {
|
||||||
const auto& lights = engine->get_scene()->get_all<Light>();
|
const auto& lights = engine->get_scene()->get_all<Light>();
|
||||||
|
|
||||||
ImGui::Text("Lights");
|
if(ImGui::CollapsingHeader("Lights")) {
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
for (auto&[obj, light]: lights) {
|
for (auto&[obj, light]: lights) {
|
||||||
ImGui::PushID(obj);
|
ImGui::PushID(obj);
|
||||||
|
|
||||||
|
@ -66,17 +63,16 @@ void draw_lighting() {
|
||||||
|
|
||||||
auto& transform = engine->get_scene()->get<Transform>(obj);
|
auto& transform = engine->get_scene()->get<Transform>(obj);
|
||||||
ImGui::DragFloat3("Position", transform.position.ptr());
|
ImGui::DragFloat3("Position", transform.position.ptr());
|
||||||
ImGui::DragFloat("Light Size", &light.size, 0.1f);
|
ImGui::DragFloat("Size", &light.size, 0.1f);
|
||||||
ImGui::Checkbox("Shadows enable", &light.enable_shadows);
|
ImGui::Checkbox("Enable Shadows", &light.enable_shadows);
|
||||||
|
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Text("Environment");
|
if(ImGui::CollapsingHeader("Environment")) {
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
for(auto& [obj, probe] : engine->get_scene()->get_all<EnvironmentProbe>()) {
|
for(auto& [obj, probe] : engine->get_scene()->get_all<EnvironmentProbe>()) {
|
||||||
ImGui::PushID(obj);
|
ImGui::PushID(obj);
|
||||||
|
|
||||||
|
@ -90,10 +86,9 @@ void draw_lighting() {
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::Text("Materials");
|
if(ImGui::CollapsingHeader("Materials")) {
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
for (auto& material: assetm->get_all<Material>()) {
|
for (auto& material: assetm->get_all<Material>()) {
|
||||||
ImGui::PushID(material);
|
ImGui::PushID(material);
|
||||||
|
|
||||||
|
@ -106,14 +101,13 @@ void draw_lighting() {
|
||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(ImGui::Button("Reload shadows")) {
|
if(ImGui::Button("Reload shadows"))
|
||||||
engine->get_scene()->reset_shadows();
|
engine->get_scene()->reset_shadows();
|
||||||
}
|
|
||||||
|
|
||||||
if(ImGui::Button("Reload probes")) {
|
if(ImGui::Button("Reload probes"))
|
||||||
engine->get_scene()->reset_environment();
|
engine->get_scene()->reset_environment();
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ImGui::TextDisabled("No scene loaded.");
|
ImGui::TextDisabled("No scene loaded.");
|
||||||
}
|
}
|
||||||
|
@ -162,22 +156,30 @@ void draw_renderer() {
|
||||||
|
|
||||||
ImGui::ComboEnum("Display Color Space", &render_options.display_color_space);
|
ImGui::ComboEnum("Display Color Space", &render_options.display_color_space);
|
||||||
ImGui::ComboEnum("Tonemapping", &render_options.tonemapping);
|
ImGui::ComboEnum("Tonemapping", &render_options.tonemapping);
|
||||||
|
|
||||||
|
if(ImGui::CollapsingHeader("Tonemapping")) {
|
||||||
ImGui::DragFloat("Exposure", &render_options.exposure, 0.1f);
|
ImGui::DragFloat("Exposure", &render_options.exposure, 0.1f);
|
||||||
ImGui::DragFloat("Min Luminance", &render_options.min_luminance);
|
ImGui::DragFloat("Min Luminance", &render_options.min_luminance);
|
||||||
ImGui::DragFloat("Max Luminance", &render_options.max_luminance);
|
ImGui::DragFloat("Max Luminance", &render_options.max_luminance);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ImGui::CollapsingHeader("Depth of Field")) {
|
||||||
ImGui::Checkbox("Enable DoF", &render_options.enable_depth_of_field);
|
ImGui::Checkbox("Enable DoF", &render_options.enable_depth_of_field);
|
||||||
ImGui::DragFloat("DoF Strength", &render_options.depth_of_field_strength);
|
ImGui::DragFloat("DoF Strength", &render_options.depth_of_field_strength);
|
||||||
|
}
|
||||||
|
|
||||||
bool should_recompile = false;
|
bool should_recompile = false;
|
||||||
|
|
||||||
|
if(ImGui::CollapsingHeader("Dynamic Resolution")) {
|
||||||
ImGui::Checkbox("Enable Dynamic Resolution", &render_options.dynamic_resolution);
|
ImGui::Checkbox("Enable Dynamic Resolution", &render_options.dynamic_resolution);
|
||||||
|
|
||||||
float render_scale = render_options.render_scale;
|
float render_scale = render_options.render_scale;
|
||||||
if(ImGui::DragFloat("Render Scale", &render_scale, 0.1f, 1.0f, 0.1f) && render_scale > 0.0f) {
|
if (ImGui::DragFloat("Render Scale", &render_scale, 0.1f, 1.0f, 0.1f)
|
||||||
|
&& render_scale > 0.0f) {
|
||||||
render_options.render_scale = render_scale;
|
render_options.render_scale = render_scale;
|
||||||
engine->get_renderer()->recreate_all_render_targets();
|
engine->get_renderer()->recreate_all_render_targets();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(ImGui::InputInt("Shadow Resolution", &render_options.shadow_resolution)) {
|
if(ImGui::InputInt("Shadow Resolution", &render_options.shadow_resolution)) {
|
||||||
engine->get_renderer()->shadow_pass->create_scene_resources(*engine->get_scene());
|
engine->get_renderer()->shadow_pass->create_scene_resources(*engine->get_scene());
|
||||||
|
|
Reference in a new issue