Editor: group Details parameters and reorganize Stats panel
Details: multi-parameter components (RigidBody/Joint/CharacterController/ Animation) now use SeparatorText category headers in UE Details style; all parameter labels normalized to Pascal Case. Stats: rearranged into View / Scene / Rendering / Physics / Performance collapsing groups. Clear Color moved to Scene, Debug View to Rendering, GPU Timings + Frame merged into Performance; bare top-level widgets and the now-obsolete Environment group removed.
This commit is contained in:
+54
-60
@@ -1,5 +1,8 @@
|
||||
//
|
||||
// StatsPanel.cpp:遥测与全局设置实现(原 main.cpp Scene Debug 搬迁)。
|
||||
// 面板按 View / Scene / Rendering / Physics / Performance 分组——
|
||||
// 环境贴图/环境光已实体化(Skybox/SkyLight 组件,Details 配置),
|
||||
// 此处只留场景级 ClearColor。
|
||||
//
|
||||
|
||||
#include "StatsPanel.h"
|
||||
@@ -19,12 +22,23 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
auto& renderer = *ctx.renderer;
|
||||
auto& app = *ctx.app;
|
||||
|
||||
// ---- Camera:视图相机位姿(只读遥测;跟随渲染源分派)----
|
||||
// ---- View:看哪里(渲染目标)+ 相机位姿(跟随渲染源分派)----
|
||||
if (ImGui::CollapsingHeader("View", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
if (ctx.renderer->GetDisplayMode() == kDisplayViewport && ctx.editorCamera)
|
||||
static const char* displayTarget[] = {
|
||||
"Fullscreen",
|
||||
"Viewport",
|
||||
};
|
||||
int mode = renderer.GetDisplayMode();
|
||||
if (ImGui::Combo("Display Target", &mode, displayTarget,
|
||||
IM_ARRAYSIZE(displayTarget)))
|
||||
{
|
||||
renderer.SetDisplayMode(mode);
|
||||
}
|
||||
if (renderer.GetDisplayMode() == kDisplayViewport && ctx.editorCamera)
|
||||
{
|
||||
const glm::vec3& pos = ctx.editorCamera->GetTransform().GetPosition();
|
||||
ImGui::Text("Editor camera pos");
|
||||
ImGui::Text("Editor Camera Pos");
|
||||
ImGui::Text("(%.3f, %.3f, %.3f)", pos.x, pos.y, pos.z);
|
||||
}
|
||||
else
|
||||
@@ -34,7 +48,7 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
{
|
||||
// world 位姿(相机实体可能挂父层级下)
|
||||
const glm::vec3& pos = camT->GetWorldPosition();
|
||||
ImGui::Text("Game camera pos");
|
||||
ImGui::Text("Game Camera Pos");
|
||||
ImGui::Text("(%.3f, %.3f, %.3f)", pos.x, pos.y, pos.z);
|
||||
}
|
||||
else
|
||||
@@ -42,35 +56,26 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
ImGui::TextDisabled("(no primary camera)");
|
||||
}
|
||||
}
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
static const char* displayTarget[] = {
|
||||
"Fullscreen",
|
||||
"Viewport",
|
||||
};
|
||||
int mode = renderer.GetDisplayMode();
|
||||
if (ImGui::Combo("##DisplayTarget", &mode, displayTarget, IM_ARRAYSIZE(displayTarget))) {
|
||||
renderer.SetDisplayMode(mode);
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
|
||||
// ---- Scene:暂停模拟(引擎 Time 门面:动画/物理统一冻结)----
|
||||
// ---- Scene:模拟控制 + 场景级设置 ----
|
||||
if (ImGui::CollapsingHeader("Scene", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
// 暂停模拟(引擎 Time 门面:动画/物理统一冻结)
|
||||
bool paused = Time::TimeScale() == 0.0f;
|
||||
if (ImGui::Checkbox("Pause Simulation", &paused))
|
||||
{
|
||||
Time::SetTimeScale(paused ? 0.0f : 1.0f);
|
||||
}
|
||||
ImGui::ColorEdit4("Clear Color",
|
||||
glm::value_ptr(ctx.scene->GetSettings().ClearColor));
|
||||
}
|
||||
|
||||
// ---- Rendering:渲染管线参数与开关 ----
|
||||
if (ImGui::CollapsingHeader("Rendering", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
f32 exposure = renderer.GetExposure();
|
||||
if (ImGui::SliderFloat("exposure", &exposure, 0.1f, 4.0f))
|
||||
if (ImGui::SliderFloat("Exposure", &exposure, 0.1f, 4.0f))
|
||||
{
|
||||
renderer.SetExposure(exposure);
|
||||
}
|
||||
@@ -89,12 +94,12 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
if (bloom)
|
||||
{
|
||||
f32 threshold = renderer.GetBloomThreshold();
|
||||
if (ImGui::SliderFloat("threshold", &threshold, 0.0f, 2.0f))
|
||||
if (ImGui::SliderFloat("Threshold", &threshold, 0.0f, 2.0f))
|
||||
{
|
||||
renderer.SetBloomThreshold(threshold);
|
||||
}
|
||||
f32 strength = renderer.GetBloomStrength();
|
||||
if (ImGui::SliderFloat("strength", &strength, 0.0f, 2.0f))
|
||||
if (ImGui::SliderFloat("Strength", &strength, 0.0f, 2.0f))
|
||||
{
|
||||
renderer.SetBloomStrength(strength);
|
||||
}
|
||||
@@ -118,14 +123,6 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
{
|
||||
renderer.SetLodEnabled(lod); // 关 = 恒绘原网格
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Environment:清屏色 + 调试视图(决定"看什么")。
|
||||
// 环境贴图/环境光已迁为实体组件(Skybox/SkyLight),在 Details 配 ----
|
||||
if (ImGui::CollapsingHeader("Environment", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::ColorEdit4("ClearColor",
|
||||
glm::value_ptr(ctx.scene->GetSettings().ClearColor));
|
||||
|
||||
// 调试视图:单看某个 pass 的中间输出(类 UE pass debug)
|
||||
const auto& viewNames = renderer.GetDebugViewNames();
|
||||
@@ -137,13 +134,13 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Physics Debug:物理调试可视化(collider/约束/重力/速度/加速度)----
|
||||
if (ImGui::CollapsingHeader("Physics Debug"))
|
||||
// ---- Physics:调试可视化(collider/约束/重力/速度/加速度)----
|
||||
if (ImGui::CollapsingHeader("Physics"))
|
||||
{
|
||||
auto& physics = app.GetPhysics();
|
||||
u32 bits = physics.GetDebugDrawBits();
|
||||
bool master = bits != 0;
|
||||
if (ImGui::Checkbox("Enable##PhysDebug", &master))
|
||||
if (ImGui::Checkbox("Debug Draw##Phys", &master))
|
||||
{
|
||||
bits = master ? kPhyDbgDefault : 0;
|
||||
}
|
||||
@@ -169,9 +166,32 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
ImGui::Text("contacts (frame): %zu", physics.GetEvents().size());
|
||||
}
|
||||
|
||||
// ---- GPU Timings:只读遥测(默认折叠,不占面板高度)----
|
||||
if (ImGui::CollapsingHeader("GPU Timings"))
|
||||
// ---- Performance:帧率控制 + GPU 遥测(默认折叠,不占面板高度)----
|
||||
if (ImGui::CollapsingHeader("Performance"))
|
||||
{
|
||||
bool vsync = app.GetVSync();
|
||||
if (ImGui::Checkbox("VSync", &vsync))
|
||||
{
|
||||
app.SetVSync(vsync);
|
||||
if (!vsync)
|
||||
{
|
||||
const f32 target = app.GetTargetFps();
|
||||
app.SetTargetFps(target);
|
||||
}
|
||||
}
|
||||
if (!vsync)
|
||||
{
|
||||
f32 target = app.GetTargetFps();
|
||||
if (ImGui::SliderFloat("Target FPS", &target, 24.0f, 360.0f, "%.0f"))
|
||||
{
|
||||
app.SetTargetFps(target);
|
||||
}
|
||||
}
|
||||
ImGui::Text("fps: %.1f frame: %llu",
|
||||
1.0f / Time::Current().UnscaledDt(),
|
||||
static_cast<unsigned long long>(app.GetFrameCount()));
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::Text("instances: %u main / %u shadow",
|
||||
renderer.GetMainInstanceCount(),
|
||||
renderer.GetShadowInstanceCount());
|
||||
@@ -188,31 +208,5 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Frame:帧率控制与显示 ----
|
||||
if (ImGui::CollapsingHeader("Frame", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
bool vsync = app.GetVSync();
|
||||
if (ImGui::Checkbox("VSync", &vsync))
|
||||
{
|
||||
app.SetVSync(vsync);
|
||||
if (!vsync)
|
||||
{
|
||||
const f32 target = app.GetTargetFps();
|
||||
app.SetTargetFps(target);
|
||||
}
|
||||
}
|
||||
if (!vsync)
|
||||
{
|
||||
f32 target = app.GetTargetFps();
|
||||
if (ImGui::SliderFloat("target fps", &target, 24.0f, 360.0f, "%.0f"))
|
||||
{
|
||||
app.SetTargetFps(target);
|
||||
}
|
||||
}
|
||||
ImGui::Text("fps: %.1f frame: %llu",
|
||||
1.0f / Time::Current().UnscaledDt(),
|
||||
static_cast<unsigned long long>(app.GetFrameCount()));
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user