|
1 | 1 | #include "MeshCraft/MeshCraftApplication.hpp" |
| 2 | +#include "MeshCraft/GraphicsBackendCheck.hpp" |
2 | 3 | #include "MeshCraftPrivate.hpp" |
3 | 4 |
|
4 | 5 | #include <imgui.h> |
@@ -551,28 +552,32 @@ float MeshCraftApplication::drawMenuBar() |
551 | 552 | ImGui::MenuItem("Edge Overlay", "Alt+W", &showEdgeOverlay_); |
552 | 553 | ImGui::MenuItem("Wireframe Mode", nullptr, &showWireframeMode_); |
553 | 554 | ImGui::MenuItem("Stats Overlay", nullptr, &showStatsOverlay_); |
554 | | - ImGui::MenuItem("Bloom (emissive glow)", nullptr, &bloomEnabled_); |
555 | | - if (bloomEnabled_) { |
556 | | - ImGui::SetNextItemWidth(140); |
557 | | - // AlwaysClamp: without it, Ctrl+Click lets a typed value go |
558 | | - // out of [min,max] (incl. negative), which the composite |
559 | | - // shader has no other guard against (STAB-0325). |
560 | | - ImGui::SliderFloat(" Strength##bloom", &bloomStrength_, 0.5f, 8.0f, "%.1f", |
561 | | - ImGuiSliderFlags_AlwaysClamp); |
562 | | - } |
563 | | - ImGui::MenuItem("SSAO (ambient occlusion)", nullptr, &ssaoEnabled_); |
564 | | - if (ssaoEnabled_) { |
565 | | - ImGui::SetNextItemWidth(140); |
566 | | - // AlwaysClamp: same out-of-bounds-via-Ctrl+Click risk as |
567 | | - // bloom strength above (STAB-0326). |
568 | | - ImGui::SliderFloat(" Strength##ssao", &ssaoStrength_, 0.0f, 1.0f, "%.2f", |
569 | | - ImGuiSliderFlags_AlwaysClamp); |
570 | | - ImGui::SetNextItemWidth(140); |
571 | | - // Same fix applied here too: a negative/zero radius from an |
572 | | - // unclamped Ctrl+Click entry would break the SSAO sample |
573 | | - // kernel, same root cause as the two strength sliders above. |
574 | | - ImGui::SliderFloat(" Radius##ssao", &ssaoRadius_, 0.05f, 2.0f, "%.2f", |
575 | | - ImGuiSliderFlags_AlwaysClamp); |
| 555 | + if (supportsTextShaderEffects()) { |
| 556 | + ImGui::MenuItem("Bloom (emissive glow)", nullptr, &bloomEnabled_); |
| 557 | + if (bloomEnabled_) { |
| 558 | + ImGui::SetNextItemWidth(140); |
| 559 | + // AlwaysClamp: without it, Ctrl+Click lets a typed value go |
| 560 | + // out of [min,max] (incl. negative), which the composite |
| 561 | + // shader has no other guard against (STAB-0325). |
| 562 | + ImGui::SliderFloat(" Strength##bloom", &bloomStrength_, 0.5f, 8.0f, "%.1f", |
| 563 | + ImGuiSliderFlags_AlwaysClamp); |
| 564 | + } |
| 565 | + ImGui::MenuItem("SSAO (ambient occlusion)", nullptr, &ssaoEnabled_); |
| 566 | + if (ssaoEnabled_) { |
| 567 | + ImGui::SetNextItemWidth(140); |
| 568 | + // AlwaysClamp: same out-of-bounds-via-Ctrl+Click risk as |
| 569 | + // bloom strength above (STAB-0326). |
| 570 | + ImGui::SliderFloat(" Strength##ssao", &ssaoStrength_, 0.0f, 1.0f, "%.2f", |
| 571 | + ImGuiSliderFlags_AlwaysClamp); |
| 572 | + ImGui::SetNextItemWidth(140); |
| 573 | + // Same fix applied here too: a negative/zero radius from an |
| 574 | + // unclamped Ctrl+Click entry would break the SSAO sample |
| 575 | + // kernel, same root cause as the two strength sliders above. |
| 576 | + ImGui::SliderFloat(" Radius##ssao", &ssaoRadius_, 0.05f, 2.0f, "%.2f", |
| 577 | + ImGuiSliderFlags_AlwaysClamp); |
| 578 | + } |
| 579 | + } else { |
| 580 | + ImGui::TextDisabled("Bloom and SSAO require cross-backend ShaderEffect support"); |
576 | 581 | } |
577 | 582 | ImGui::MenuItem("Shadow Map Debug", nullptr, &shadowDebugEnabled_); |
578 | 583 | ImGui::MenuItem("Snap to Grid", nullptr, &snapEnabled_); |
|
0 commit comments