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