feat: HitProxy GPU 拾取 + UE 选中描边 + 编辑器拾取交互
- HitProxy 拾取:RG 管线渲染实体 id → host readback,点击帧 PickEntity 精确命中;拾取按视觉几何(Model 联合包围球射线求交), 与 Collider 解耦(UE/Unity 编辑器语义),命中打印实体名+碰撞体参数 - 选中描边(UE 语义):SelectionMask pass(R8Unorm 完整投影轮廓, 无深度测试透墙可见)→ Outline pass(边缘检测 + alpha 叠加, 必须注册在 Tonemap 后);edgeCut 贴视口边缘;widthPx=6 可调 - shader object 实证修复:VUID-08879 同程序 set layouts 超集一致、 VUID-10065 push block 4×float 平铺、新 pass 析构销毁 VkShaderEXT - RG:SideEffect() 保活"产出无 RG 内消费者"的 pass 链 - Editor:层次面板点击选中、Inspector 姿态编辑、Stats 面板拾取信息 - 相机 Update 改 const(姿态写入 Transform 引用,Camera 本身无状态变更)
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "StatsPanel.h"
|
||||
#include "Engine/ECS/Components.h"
|
||||
#include "Engine/Physics/PhysicsWorld.h"
|
||||
#include "Engine/Core/Time.h"
|
||||
|
||||
#include <imgui.h>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
@@ -33,10 +35,25 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
ImGui::Separator();
|
||||
}
|
||||
|
||||
// ---- Scene:动画时钟冻结(沙盒 spinners 用)----
|
||||
if (ctx.pauseAnim != nullptr)
|
||||
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 门面:动画/物理统一冻结)----
|
||||
{
|
||||
ImGui::Checkbox("Pause Animation", ctx.pauseAnim);
|
||||
bool paused = Time::TimeScale() == 0.0f;
|
||||
if (ImGui::Checkbox("Pause Simulation", &paused))
|
||||
{
|
||||
Time::SetTimeScale(paused ? 0.0f : 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Rendering:渲染管线参数与开关 ----
|
||||
@@ -124,6 +141,38 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Physics Debug:物理调试可视化(collider/约束/重力/速度/加速度)----
|
||||
if (ImGui::CollapsingHeader("Physics Debug"))
|
||||
{
|
||||
auto& physics = app.GetPhysics();
|
||||
u32 bits = physics.GetDebugDrawBits();
|
||||
bool master = bits != 0;
|
||||
if (ImGui::Checkbox("Enable##PhysDebug", &master))
|
||||
{
|
||||
bits = master ? kPhyDbgDefault : 0;
|
||||
}
|
||||
if (master)
|
||||
{
|
||||
ImGui::Indent();
|
||||
auto toggle = [&bits](const char* label, u32 bit) {
|
||||
bool on = (bits & bit) != 0;
|
||||
if (ImGui::Checkbox(label, &on))
|
||||
{
|
||||
bits = on ? (bits | bit) : (bits & ~bit);
|
||||
}
|
||||
};
|
||||
toggle("Colliders", kPhyDbgColliders);
|
||||
toggle("Constraints", kPhyDbgConstraints);
|
||||
toggle("Gravity", kPhyDbgGravity);
|
||||
toggle("Velocity", kPhyDbgVelocity);
|
||||
toggle("Acceleration", kPhyDbgAccel);
|
||||
ImGui::Unindent();
|
||||
}
|
||||
physics.SetDebugDrawBits(bits);
|
||||
// 碰撞事件计数(最近一次步进;掉落物触地时应 > 0)
|
||||
ImGui::Text("contacts (frame): %zu", physics.GetEvents().size());
|
||||
}
|
||||
|
||||
// ---- GPU Timings:只读遥测(默认折叠,不占面板高度)----
|
||||
if (ImGui::CollapsingHeader("GPU Timings"))
|
||||
{
|
||||
@@ -165,8 +214,8 @@ void StatsPanel::Draw(const EditorContext& ctx)
|
||||
}
|
||||
}
|
||||
ImGui::Text("fps: %.1f frame: %llu",
|
||||
1.0f / app.GetDeltaTime(),
|
||||
static_cast<unsigned long long>(app.GetFrameCount()));
|
||||
1.0f / Time::Current().UnscaledDt(),
|
||||
static_cast<unsigned long long>(app.GetFrameCount()));
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
|
||||
Reference in New Issue
Block a user