Foundation
Loading...
Searching...
No Matches
Macros | Enumerations | Functions
ImGui.hpp File Reference
#include <imgui.h>
#include <RHICore/Device.hpp>
#include <RenderCore/Renderer.hpp>
#include <Rendering/TexturePool.hpp>

Go to the source code of this file.

Macros

#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
 
#define IMGUI_DEFINE_MATH_OPERATORS
 
#define IMGUI_DISABLE_DEFAULT_ALLOCATORS
 

Enumerations

enum  ImGui_ImplFoundation_ImageSampler { ImGuiImplFoundationImageSamplerLinear = 0 , ImGuiImplFoundationImageSamplerNearest = 1 }
 Sampler type for added image. More...
 

Functions

void ImGui_ImplFoundation_ImplUpdateTexture (ImTextureData *tex)
 
void ImGui_ImplFoundation_ImplPassSetup (Foundation::RenderCore::PassHandle self, Foundation::RenderCore::Renderer *renderer, Foundation::RenderCore::ResourceHandle vtxBuffer, Foundation::RenderCore::ResourceHandle idxBuffer, Foundation::RenderCore::ResourceHandle linSampler, Foundation::RenderCore::ResourceHandle nearSampler)
 
void ImGui_ImplFoundation_ImplPassRecord (Foundation::RenderCore::PassHandle self, Foundation::RenderCore::Renderer *renderer, bool clear, Foundation::RHI::RHICommandList *cmd, Foundation::RenderCore::ResourceHandle vtxBuffer, Foundation::RenderCore::ResourceHandle idxBuffer)
 
void ImGui_ImplFoundation_ImplCreateResources (Foundation::RenderCore::Renderer *renderer, Foundation::RenderCore::ResourceHandle &outVtxBuffer, Foundation::RenderCore::ResourceHandle &outIdxBuffer, Foundation::RenderCore::ResourceHandle &outLinearSampler, Foundation::RenderCore::ResourceHandle &outNearestSampler)
 
void ImGui_ImplFoundation_Init (Foundation::RHI::RHIDevice *device, Foundation::Native::NativeWindow *window, Foundation::Core::Allocator *allocator)
 
void ImGui_ImplFoundation_NewFrame ()
 Starts a new ImGui frame.
 
void ImGui_ImplFoundation_Shutdown ()
 Shuts down the ImGui backend and releases all resources.
 
ImTextureID ImGui_ImplFoundation_AddImage (Foundation::RHI::RHITextureView *textureView, ImGui_ImplFoundation_ImageSampler sampler=ImGuiImplFoundationImageSamplerLinear)
 Registers a texture with the ImGui backend so it can be displayed in the UI.
 
void ImGui_ImplFoundation_RemoveImage (ImTextureID textureID)
 Unregisters a texture from the ImGui backend.
 
template<typename FSetup >
auto * ImGui_ImplFoundation_CreatePass (Foundation::RenderCore::Renderer *renderer, Foundation::Core::StringView name, bool clear, FSetup &&setup)
 Creates a render pass that will draw the ImGui UI.
 
auto * ImGui_ImplFoundation_CreatePass (Foundation::RenderCore::Renderer *renderer, Foundation::Core::StringView name, bool clear=true)
 Creates a render pass that will draw the ImGui UI.
 
void ImGui_ImplFoundation_SetupContextWithDefaultStyles ()
 Applies a default, vaguely stylish theme to the ImGui context.
 

Macro Definition Documentation

◆ IMGUI_DEFINE_MATH_OPERATORS

#define IMGUI_DEFINE_MATH_OPERATORS

◆ IMGUI_DISABLE_DEFAULT_ALLOCATORS

#define IMGUI_DISABLE_DEFAULT_ALLOCATORS

◆ IMGUI_DISABLE_OBSOLETE_FUNCTIONS

#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS

Enumeration Type Documentation

◆ ImGui_ImplFoundation_ImageSampler

Sampler type for added image.

Enumerator
ImGuiImplFoundationImageSamplerLinear 
ImGuiImplFoundationImageSamplerNearest 

Function Documentation

◆ ImGui_ImplFoundation_AddImage()

Registers a texture with the ImGui backend so it can be displayed in the UI.

Parameters
textureViewThe texture view to be used.
samplerThe sampler to be used for the texture.
Returns
An ImTextureID that you can use with ImGui::Image() and other functions.

◆ ImGui_ImplFoundation_CreatePass() [1/2]

template<typename FSetup >
auto * ImGui_ImplFoundation_CreatePass ( Foundation::RenderCore::Renderer renderer,
Foundation::Core::StringView  name,
bool  clear,
FSetup &&  setup 
)

Creates a render pass that will draw the ImGui UI.

Template Parameters
FSetupA callable type for custom render pass setup. You may want this when ImGui is the last pass of your Renderer setup, as you can declare dependencies here. See ModelViewer's OnRendererSetup for an example. However - if your prior pass writes to the backbuffer as well - dependency will be automatically created and this won't be required.
Parameters
rendererThe main renderer object.
nameA name for the pass, for debugging purposes.
clearWhether to clear the render target before drawing.
Examples
ImGui.cpp, and MipGeneration.cpp.

◆ ImGui_ImplFoundation_CreatePass() [2/2]

auto * ImGui_ImplFoundation_CreatePass ( Foundation::RenderCore::Renderer renderer,
Foundation::Core::StringView  name,
bool  clear = true 
)
inline

Creates a render pass that will draw the ImGui UI.

Parameters
rendererThe main renderer object.
nameA name for the pass, for debugging purposes.
clearWhether to clear the render target before drawing. Defaults to true.

◆ ImGui_ImplFoundation_ImplCreateResources()

void ImGui_ImplFoundation_ImplCreateResources ( Foundation::RenderCore::Renderer renderer,
Foundation::RenderCore::ResourceHandle outVtxBuffer,
Foundation::RenderCore::ResourceHandle outIdxBuffer,
Foundation::RenderCore::ResourceHandle outLinearSampler,
Foundation::RenderCore::ResourceHandle outNearestSampler 
)

◆ ImGui_ImplFoundation_ImplPassRecord()

◆ ImGui_ImplFoundation_ImplPassSetup()

◆ ImGui_ImplFoundation_ImplUpdateTexture()

void ImGui_ImplFoundation_ImplUpdateTexture ( ImTextureData tex)

◆ ImGui_ImplFoundation_Init()

void ImGui_ImplFoundation_Init ( Foundation::RHI::RHIDevice device,
Foundation::Native::NativeWindow window,
Foundation::Core::Allocator allocator 
)

@breif Initialize global context (TexturePool, etc) for our ImGui backend

Parameters
deviceRHIDevice of the Renderer
windowNativeWindow that the current RHISwapchain is constructed upon
allocatorAllocator used for ImGui and internal state tracking.
Note
You MUST call ImGui_ImplFoundation_Shutdown before the destruction of RHIDevice related objects. See Examples::ImGui or other ImGui backend usage for reference.

◆ ImGui_ImplFoundation_NewFrame()

void ImGui_ImplFoundation_NewFrame ( )

Starts a new ImGui frame.

Note
You should call this once per frame, before any other ImGui calls. See Examples::ImGui or other ImGui backend usage for reference.

◆ ImGui_ImplFoundation_RemoveImage()

void ImGui_ImplFoundation_RemoveImage ( ImTextureID  textureID)

Unregisters a texture from the ImGui backend.

Parameters
textureIDThe ID returned by ImGui_ImplFoundation_AddImage.
Note
Call this when you no longer need the texture in the UI to free up resources.

◆ ImGui_ImplFoundation_SetupContextWithDefaultStyles()

void ImGui_ImplFoundation_SetupContextWithDefaultStyles ( )

Applies a default, vaguely stylish theme to the ImGui context.

Note
Call this after ImGui_ImplFoundation_Init if you don't want to set up your own styles.

◆ ImGui_ImplFoundation_Shutdown()

void ImGui_ImplFoundation_Shutdown ( )

Shuts down the ImGui backend and releases all resources.

Note
You MUST call ImGui_ImplFoundation_Shutdown before the destruction of RHIDevice related objects. See Examples::ImGui or other ImGui backend usage for reference.