feat: ImGui 调试面板分组整理
Scene/Rendering/Environment/GPU Timings/Frame 五个 CollapsingHeader; 功能开关用 checkbox 条件显隐联动参数(Bloom 勾选才出现 threshold/ strength),无参数开关横排平铺。
This commit is contained in:
+34
-20
@@ -162,8 +162,12 @@ namespace
|
||||
void OnRenderOverlay() override
|
||||
{
|
||||
ImGui::Begin("Scene Debug");
|
||||
auto& renderer = GetRenderer();
|
||||
|
||||
// 阴影光源方向:拖动滑条实时看影子变化
|
||||
// ---- Scene:场景内容(灯/动画) ----
|
||||
if (ImGui::CollapsingHeader("Scene", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
// 阴影光源(无开关,控件平铺聚拢)
|
||||
if (auto* light = m_KeyLight.TryGetComponent<LightComponent>())
|
||||
{
|
||||
ImGui::Text("Key Light (shadow caster)");
|
||||
@@ -176,11 +180,13 @@ namespace
|
||||
light->color.a = 2.0f;
|
||||
}
|
||||
}
|
||||
ImGui::Checkbox("Pause Animation", &m_PauseAnim);
|
||||
}
|
||||
|
||||
// Tonemap + Bloom 参数(HDR 后处理输出端)
|
||||
auto& renderer = GetRenderer();
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Tonemap");
|
||||
// ---- Rendering:渲染管线参数与开关 ----
|
||||
if (ImGui::CollapsingHeader("Rendering", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
// Tonemap(无开关,平铺)
|
||||
f32 exposure = renderer.GetExposure();
|
||||
if (ImGui::SliderFloat("exposure", &exposure, 0.1f, 4.0f))
|
||||
{
|
||||
@@ -192,7 +198,14 @@ namespace
|
||||
renderer.SetUseACES(aces);
|
||||
}
|
||||
|
||||
ImGui::Text("Bloom");
|
||||
// Bloom:开关即显隐——勾上才显示参数
|
||||
bool bloom = renderer.GetBloomEnabled();
|
||||
if (ImGui::Checkbox("Bloom", &bloom))
|
||||
{
|
||||
renderer.SetBloomEnabled(bloom);
|
||||
}
|
||||
if (bloom)
|
||||
{
|
||||
f32 threshold = renderer.GetBloomThreshold();
|
||||
if (ImGui::SliderFloat("threshold", &threshold, 0.0f, 2.0f))
|
||||
{
|
||||
@@ -203,26 +216,26 @@ namespace
|
||||
{
|
||||
renderer.SetBloomStrength(strength);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Text("Features");
|
||||
// 无参数的纯开关:横排平铺
|
||||
bool shadows = renderer.GetShadowsEnabled();
|
||||
if (ImGui::Checkbox("Shadows", &shadows))
|
||||
{
|
||||
renderer.SetShadowsEnabled(shadows);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
bool taa = renderer.GetTAAEnabled();
|
||||
if (ImGui::Checkbox("TAA", &taa))
|
||||
{
|
||||
renderer.SetTAAEnabled(taa);
|
||||
}
|
||||
bool bloom = renderer.GetBloomEnabled();
|
||||
if (ImGui::Checkbox("Bloom", &bloom))
|
||||
{
|
||||
renderer.SetBloomEnabled(bloom);
|
||||
}
|
||||
|
||||
// ---- Environment:IBL 环境 + 调试视图(决定"看什么") ----
|
||||
if (ImGui::CollapsingHeader("Environment", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
// 动态环境切换(Assets 层加载 → Renderer 换绑;缓存去重)
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Environment (IBL)");
|
||||
int envIdx = m_EnvIndex;
|
||||
if (ImGui::Combo("env", &envIdx, kEnvNames, kEnvCount))
|
||||
@@ -244,11 +257,12 @@ namespace
|
||||
{
|
||||
renderer.SetDebugView(view);
|
||||
}
|
||||
ImGui::Checkbox("Pause Animation", &m_PauseAnim);
|
||||
}
|
||||
|
||||
// ---- GPU Timings:只读遥测(默认折叠,不占面板高度) ----
|
||||
if (ImGui::CollapsingHeader("GPU Timings"))
|
||||
{
|
||||
// Pass 级 GPU 耗时(RG timestamp)
|
||||
ImGui::Separator();
|
||||
ImGui::Text("GPU Timings");
|
||||
ImGui::Text("instances: %u main / %u shadow",
|
||||
renderer.GetMainInstanceCount(),
|
||||
renderer.GetShadowInstanceCount());
|
||||
@@ -258,11 +272,12 @@ namespace
|
||||
{
|
||||
ImGui::Text(" %-12s %.3f ms", names[i].c_str(), times[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// 帧率控制
|
||||
// ---- Frame:帧率控制与显示 ----
|
||||
if (ImGui::CollapsingHeader("Frame", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
auto& app = *this;
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Frame");
|
||||
bool vsync = app.GetVSync();
|
||||
if (ImGui::Checkbox("VSync", &vsync))
|
||||
{
|
||||
@@ -281,11 +296,10 @@ namespace
|
||||
app.SetTargetFps(target);
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::Text("fps: %.1f frame: %llu",
|
||||
1.0f / GetDeltaTime(),
|
||||
static_cast<unsigned long long>(GetFrameCount()));
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user