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:
@@ -76,6 +76,11 @@ void InspectorPanel::Draw(const EditorContext& ctx, entt::entity selected)
|
||||
{
|
||||
reg.emplace<Engine::ECS::NameComponent>(selected);
|
||||
}
|
||||
if (!reg.all_of<Engine::ECS::RigidBodyComponent>(selected) &&
|
||||
ImGui::MenuItem("RigidBody"))
|
||||
{
|
||||
reg.emplace<Engine::ECS::RigidBodyComponent>(selected);
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::Separator();
|
||||
@@ -172,6 +177,50 @@ void InspectorPanel::Draw(const EditorContext& ctx, entt::entity selected)
|
||||
}
|
||||
}
|
||||
|
||||
// ---- RigidBody(Jolt 刚体:动态体 Transform 由物理每帧写回)----
|
||||
// type/collider/mass 变更 → PhysicsWorld 重建 body;其余参数即时生效
|
||||
if (auto* rb = reg.try_get<Engine::ECS::RigidBodyComponent>(selected))
|
||||
{
|
||||
if (ImGui::CollapsingHeader("RigidBody", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
int type = static_cast<int>(rb->type);
|
||||
if (ImGui::Combo("type", &type, "Static\0Dynamic\0Kinematic\0"))
|
||||
{
|
||||
rb->type = static_cast<Engine::ECS::RigidBodyComponent::BodyType>(type);
|
||||
}
|
||||
int collider = static_cast<int>(rb->collider);
|
||||
if (ImGui::Combo("collider", &collider, "Box\0Sphere\0Mesh\0"))
|
||||
{
|
||||
rb->collider = static_cast<Engine::ECS::RigidBodyComponent::ColliderType>(collider);
|
||||
}
|
||||
if (rb->collider == Engine::ECS::RigidBodyComponent::ColliderType::Box)
|
||||
{
|
||||
ImGui::DragFloat3("halfExtents", &rb->boxHalfExtents.x, 0.05f, 0.01f, 500.0f);
|
||||
}
|
||||
else if (rb->collider == Engine::ECS::RigidBodyComponent::ColliderType::Sphere)
|
||||
{
|
||||
ImGui::DragFloat("radius", &rb->sphereRadius, 0.05f, 0.01f, 500.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Mesh:跟随 MeshRenderer 视觉网格(Static=精确网格,
|
||||
// Dynamic=凸包近似),无尺寸可调
|
||||
ImGui::TextDisabled("follows MeshRenderer geometry");
|
||||
}
|
||||
ImGui::DragFloat("mass", &rb->mass, 0.1f, 0.1f, 1000.0f, "%.1f");
|
||||
ImGui::SliderFloat("gravityScale", &rb->gravityScale, -1.0f, 5.0f);
|
||||
ImGui::SliderFloat("friction", &rb->friction, 0.0f, 2.0f);
|
||||
ImGui::SliderFloat("restitution", &rb->restitution, 0.0f, 1.0f);
|
||||
ImGui::Checkbox("isSensor", &rb->isSensor);
|
||||
if (rb->bodyValid &&
|
||||
rb->type == Engine::ECS::RigidBodyComponent::BodyType::Dynamic)
|
||||
{
|
||||
ImGui::Text("vel: %.2f, %.2f, %.2f m/s",
|
||||
rb->velocity.x, rb->velocity.y, rb->velocity.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Animation ----
|
||||
if (auto* anim = reg.try_get<Engine::ECS::AnimationComponent>(selected))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user