Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::Rendering::WorldUiRenderer Class Reference

Renders WidgetComponent ImGui content into per-widget textures for world-space UI. More...

#include <WorldUiRenderer.h>

Collaboration diagram for Engine::Rendering::WorldUiRenderer:

Classes

struct  ImGuiTexture
struct  RetiredTarget
struct  Target
struct  TargetFrame

Public Member Functions

 WorldUiRenderer ()=default
 Creates an uninitialized world UI renderer.
 WorldUiRenderer (Core::ApplicationContext *context, uint32_t framesInFlight)
 ~WorldUiRenderer ()
 Releases renderer-owned Vulkan and ImGui resources.
 WorldUiRenderer (const WorldUiRenderer &)=delete
 World UI renderers own Vulkan resources and cannot be copied.
WorldUiRenderer & operator= (const WorldUiRenderer &)=delete
 World UI renderers own Vulkan resources and cannot be copy-assigned.
uint32_t registerWidget (Components::WidgetComponent &widget)
 Ensures a widget has a render target texture and returns its descriptor index.
void unregisterWidget (Components::WidgetComponent &widget)
 Retires the render target owned by a widget component.
void renderWidgets (VkCommandBuffer commandBuffer, uint32_t frameIndex, RenderProcess &renderProcess)
 Renders all active widget components for the current frame.

Private Member Functions

void cleanup ()
 Destroys active and retired widget render targets and renderer resources.
Target & ensureTarget (Components::WidgetComponent &widget)
void createTargetImages (Target &target) const
void destroyTarget (Target &target) const
void retireTarget (Target &&target)
void processRetiredTargets ()
void transitionTargetsToColorAttachment (VkCommandBuffer commandBuffer, uint32_t frameIndex)
void transitionTargetsToShaderRead (VkCommandBuffer commandBuffer, uint32_t frameIndex)
void renderTarget (VkCommandBuffer commandBuffer, Target &target, uint32_t frameIndex)
void prepareWidgetTextures (Components::WidgetComponent &widget)

Private Attributes

Core::ApplicationContext * context_ = nullptr
ImGuiContext * imguiContext_ = nullptr
VkDescriptorPool descriptorPool_ = VK_NULL_HANDLE
VkSampler sampler_ = VK_NULL_HANDLE
VkFormat format_ = VK_FORMAT_R8G8B8A8_UNORM
uint32_t framesInFlight_ = 0
bool initialized_ = false
std::unordered_map< Components::WidgetComponent *, Target > targets_
std::unordered_map< uint32_t, ImGuiTexture > imguiTextures_
std::vector< RetiredTarget > retiredTargets_

Detailed Description

Renders WidgetComponent ImGui content into per-widget textures for world-space UI.

Definition at line 31 of file WorldUiRenderer.h.

Constructor & Destructor Documentation

◆ WorldUiRenderer() [1/3]

Engine::Rendering::WorldUiRenderer::WorldUiRenderer ( )
default

Creates an uninitialized world UI renderer.

Referenced by operator=(), and WorldUiRenderer().

Here is the caller graph for this function:

◆ WorldUiRenderer() [2/3]

Engine::Rendering::WorldUiRenderer::WorldUiRenderer ( Core::ApplicationContext * context,
uint32_t framesInFlight )

◆ ~WorldUiRenderer()

Engine::Rendering::WorldUiRenderer::~WorldUiRenderer ( )

Releases renderer-owned Vulkan and ImGui resources.

◆ WorldUiRenderer() [3/3]

Engine::Rendering::WorldUiRenderer::WorldUiRenderer ( const WorldUiRenderer & )
delete

World UI renderers own Vulkan resources and cannot be copied.

References WorldUiRenderer().

Here is the call graph for this function:

Member Function Documentation

◆ cleanup()

void Engine::Rendering::WorldUiRenderer::cleanup ( )
private

Destroys active and retired widget render targets and renderer resources.

◆ createTargetImages()

void Engine::Rendering::WorldUiRenderer::createTargetImages ( Target & target) const
private

◆ destroyTarget()

void Engine::Rendering::WorldUiRenderer::destroyTarget ( Target & target) const
private

◆ ensureTarget()

Target & Engine::Rendering::WorldUiRenderer::ensureTarget ( Components::WidgetComponent & widget)
private

◆ operator=()

WorldUiRenderer & Engine::Rendering::WorldUiRenderer::operator= ( const WorldUiRenderer & )
delete

World UI renderers own Vulkan resources and cannot be copy-assigned.

References WorldUiRenderer().

Here is the call graph for this function:

◆ prepareWidgetTextures()

void Engine::Rendering::WorldUiRenderer::prepareWidgetTextures ( Components::WidgetComponent & widget)
private

◆ processRetiredTargets()

void Engine::Rendering::WorldUiRenderer::processRetiredTargets ( )
private

◆ registerWidget()

uint32_t Engine::Rendering::WorldUiRenderer::registerWidget ( Components::WidgetComponent & widget)
nodiscard

Ensures a widget has a render target texture and returns its descriptor index.

◆ renderTarget()

void Engine::Rendering::WorldUiRenderer::renderTarget ( VkCommandBuffer commandBuffer,
Target & target,
uint32_t frameIndex )
private

◆ renderWidgets()

void Engine::Rendering::WorldUiRenderer::renderWidgets ( VkCommandBuffer commandBuffer,
uint32_t frameIndex,
RenderProcess & renderProcess )

Renders all active widget components for the current frame.

◆ retireTarget()

void Engine::Rendering::WorldUiRenderer::retireTarget ( Target && target)
private

◆ transitionTargetsToColorAttachment()

void Engine::Rendering::WorldUiRenderer::transitionTargetsToColorAttachment ( VkCommandBuffer commandBuffer,
uint32_t frameIndex )
private

◆ transitionTargetsToShaderRead()

void Engine::Rendering::WorldUiRenderer::transitionTargetsToShaderRead ( VkCommandBuffer commandBuffer,
uint32_t frameIndex )
private

◆ unregisterWidget()

void Engine::Rendering::WorldUiRenderer::unregisterWidget ( Components::WidgetComponent & widget)

Retires the render target owned by a widget component.

Member Data Documentation

◆ context_

Core::ApplicationContext* Engine::Rendering::WorldUiRenderer::context_ = nullptr
private

Definition at line 124 of file WorldUiRenderer.h.

◆ descriptorPool_

VkDescriptorPool Engine::Rendering::WorldUiRenderer::descriptorPool_ = VK_NULL_HANDLE
private

Definition at line 126 of file WorldUiRenderer.h.

◆ format_

VkFormat Engine::Rendering::WorldUiRenderer::format_ = VK_FORMAT_R8G8B8A8_UNORM
private

Definition at line 128 of file WorldUiRenderer.h.

◆ framesInFlight_

uint32_t Engine::Rendering::WorldUiRenderer::framesInFlight_ = 0
private

Definition at line 129 of file WorldUiRenderer.h.

◆ imguiContext_

ImGuiContext* Engine::Rendering::WorldUiRenderer::imguiContext_ = nullptr
private

Definition at line 125 of file WorldUiRenderer.h.

◆ imguiTextures_

std::unordered_map<uint32_t, ImGuiTexture> Engine::Rendering::WorldUiRenderer::imguiTextures_
private

Definition at line 133 of file WorldUiRenderer.h.

◆ initialized_

bool Engine::Rendering::WorldUiRenderer::initialized_ = false
private

Definition at line 130 of file WorldUiRenderer.h.

◆ retiredTargets_

std::vector<RetiredTarget> Engine::Rendering::WorldUiRenderer::retiredTargets_
private

Definition at line 134 of file WorldUiRenderer.h.

◆ sampler_

VkSampler Engine::Rendering::WorldUiRenderer::sampler_ = VK_NULL_HANDLE
private

Definition at line 127 of file WorldUiRenderer.h.

◆ targets_

std::unordered_map<Components::WidgetComponent *, Target> Engine::Rendering::WorldUiRenderer::targets_
private

Definition at line 132 of file WorldUiRenderer.h.


The documentation for this class was generated from the following file: