feat: ImGui 叠加层接入 RenderGraph(docking 分支,dynamic rendering)
框架与 UI 的职责边界: - ImGuiLayer(Engine/ImGui):只做管线桥接——上下文初始化、 NewFrame/BuildDrawData、draw data 录入 cmd;框架自身永不绘制 任何 ImGui 控件,UI 内容全部由派生类在 OnRenderOverlay() 定义 - 每帧顺序:NewFrame → OnRenderOverlay(声明控件)→ BuildDrawData → Renderer.Render(RG: Forward → ImGui(loadOp=Load 叠加) → Present) - ImGui pass 常驻 RG,未启用叠加层时空转,无图结构开销 - 后端共存:VK_EXT_shader_object 引擎无 vk::Pipeline,ImGui 用 UseDynamicRendering + PipelineInfoMain.PipelineRenderingCreateInfo (swapchain 格式),不需要 RenderPass - 析构序:ImGuiLayer 在 Application 成员序中后声明(先于 Renderer 析构),析构内 waitIdle 保证后端资源安全销毁 App 示例(证明职责边界):Scene Debug 面板实时拖动阴影光方向, ` 键反折叠加层
This commit is contained in:
+14
-1
@@ -2,13 +2,26 @@ file(GLOB_RECURSE ENGINE_SOURCES
|
||||
src/*.cpp
|
||||
)
|
||||
|
||||
# ImGui(docking 分支,vendored submodule)
|
||||
set(IMGUI_DIR ${CMAKE_SOURCE_DIR}/Lib/imgui)
|
||||
set(IMGUI_SOURCES
|
||||
${IMGUI_DIR}/imgui.cpp
|
||||
${IMGUI_DIR}/imgui_draw.cpp
|
||||
${IMGUI_DIR}/imgui_tables.cpp
|
||||
${IMGUI_DIR}/imgui_widgets.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_glfw.cpp
|
||||
${IMGUI_DIR}/backends/imgui_impl_vulkan.cpp
|
||||
)
|
||||
|
||||
# 编译成静态库
|
||||
add_library(Engine STATIC ${ENGINE_SOURCES})
|
||||
add_library(Engine STATIC ${ENGINE_SOURCES} ${IMGUI_SOURCES})
|
||||
|
||||
|
||||
target_include_directories(Engine PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/Lib/entt/src
|
||||
${IMGUI_DIR}
|
||||
${IMGUI_DIR}/backends
|
||||
)
|
||||
|
||||
# 链接第三方库
|
||||
|
||||
Reference in New Issue
Block a user