feat: 透明窗口支持 + 退出确认流程 + ImGui 总开关

用户自主改进批次:
- 透明窗口:GLFW_TRANSPARENT_FRAMEBUFFER + 窗口 opacity 0.5,
  swapchain composite alpha 按能力自适应(Opaque/Pre/PostMultiplied),
  Forward 清屏 alpha=0,tonemap 透传 HDR alpha——物体实体、背景透明
- 退出确认:Window 挂 WindowCloseCallback 发事件,App 侧 OnWindowClose
  置确认标记,OnRenderOverlay 弹 ImGui 确认框后 Close();
  主循环退出条件改为 m_Running(close 事件驱动)
- ImGui 总开关:` 键切换 ImGuiLayer::SetEnabled,禁用时跳过
  NewFrame/OnRenderOverlay/BuildDrawData 整段
- 帧率控制简化:去掉 LimitFps 开关,非 vsync 时恒按 target 限帧
  (默认 60,可调 ≥24);m_VSync 默认 false(Mailbox 不限速)
- 清理:Model.cpp const 修正,swapchain 日志带 present mode,
  GPU 遥测暂时注释

验证:0 error 0 warning,composite alpha 实测选 PreMultiplied(0x2),
present=Mailbox
This commit is contained in:
2026-09-23 10:57:48 +08:00
parent d8274e8bdc
commit df4871a49b
10 changed files with 174 additions and 95 deletions
+1 -1
View File
@@ -178,7 +178,7 @@ Scope<Mesh> Model::ProcessMesh(aiMesh* mesh, const aiScene* scene)
aiString path;
if (material->GetTexture(aiTextureType_DIFFUSE, 0, &path) == AI_SUCCESS) {
std::filesystem::path modelDir =
const std::filesystem::path modelDir =
std::filesystem::path(m_ModelPath).parent_path();
texturePath = (modelDir / path.C_Str()).string();
}
+3 -1
View File
@@ -475,7 +475,7 @@ namespace Engine
vk::ClearValue clearValue;
clearValue.color = vk::ClearColorValue(
std::array<float, 4>{0.1f, 0.1f, 0.1f, 1.0f});
std::array<float, 4>{0.0f, 0.0f, 0.0f, 0.0f});
vk::RenderingAttachmentInfo colorAttachment;
colorAttachment.setImageView(ctx.View(m_HDRColor))
@@ -850,6 +850,7 @@ namespace Engine
: 0.0f;
}
/*
// 控制台遥测:每 120 次读取(≈60 帧 @2 slot)输出一行
static u32 telemetryCount = 0;
if (++telemetryCount % 120 == 1) {
@@ -861,6 +862,7 @@ namespace Engine
line += " collect=" + std::to_string(m_CollectMs).substr(0, 5) + "ms";
ENGINE_INFO("{}", line);
}
*/
}
void Renderer::Render(ECS::Scene& scene, Assets::AssetManager& assets)