Foundation
Loading...
Searching...
No Matches
ImGui.hpp
Go to the documentation of this file.
1#pragma once
2#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
3#define IMGUI_DEFINE_MATH_OPERATORS
4#define IMGUI_DISABLE_DEFAULT_ALLOCATORS
5#include <SDL3/SDL.h>
6#include <imgui.h>
7
8#include <RHICore/Device.hpp>
18
19/* -- Internals -- */
20void ImGui_ImplFoundation_ImplUpdateTexture(ImTextureData* tex);
28 Foundation::RenderCore::Renderer* renderer, bool clear,
37// ^^^ Internals
38
39/* -- APIs -- */
54void ImGui_ImplFoundation_Init(Foundation::RHI::RHIDevice* device, SDL_Window* window);
55
62void ImGui_ImplFoundation_ProcessEvent(SDL_Event* event);
69
76
83ImTextureID
86
92void ImGui_ImplFoundation_RemoveImage(ImTextureID textureID);
93
106template <typename FSetup>
108{
109 using namespace Foundation;
110 using namespace RenderCore;
111 using namespace RHI;
112 ResourceHandle vtxBuffer, idxBuffer, linSampler, nearSampler;
113 ImGui_ImplFoundation_ImplCreateResources(renderer, vtxBuffer, idxBuffer, linSampler, nearSampler);
114 return renderer->CreatePass(
115 "ImGui", RHIDeviceQueueType::Graphics, 0u,
116 [=](PassHandle self, Renderer* r)
117 {
118 ImGui_ImplFoundation_ImplPassSetup(self, r, vtxBuffer, idxBuffer, linSampler, nearSampler);
119 setup(self, r);
120 },
121 [=](PassHandle self, Renderer* r, RHICommandList* cmd)
122 { ImGui_ImplFoundation_ImplPassRecord(self, r, clear, cmd, vtxBuffer, idxBuffer); });
123}
124
125
131// ^^^ APIs
void ImGui_ImplFoundation_NewFrame()
Starts a new ImGui frame.
Definition ImGui.cpp:54
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.
Definition ImGui.cpp:173
void ImGui_ImplFoundation_Shutdown()
Shuts down the ImGui backend and releases all resources.
Definition ImGui.cpp:58
void ImGui_ImplFoundation_SetupContextWithDefaultStyles()
Applies a default, vaguely stylish theme to the ImGui context.
Definition ImGui.cpp:350
void ImGui_ImplFoundation_ImplUpdateTexture(ImTextureData *tex)
Definition ImGui.cpp:75
Foundation::RenderCore::PassHandle 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.
Definition ImGui.hpp:107
void ImGui_ImplFoundation_RemoveImage(ImTextureID textureID)
Unregisters a texture from the ImGui backend.
Definition ImGui.cpp:179
ImGui_ImplFoundation_ImageSampler
Sampler type for added image.
Definition ImGui.hpp:14
@ ImGuiImplFoundationImageSamplerLinear
Definition ImGui.hpp:15
@ ImGuiImplFoundationImageSamplerNearest
Definition ImGui.hpp:16
void ImGui_ImplFoundation_ImplCreateResources(Foundation::RenderCore::Renderer *renderer, Foundation::RenderCore::ResourceHandle &outVtxBuffer, Foundation::RenderCore::ResourceHandle &outIdxBuffer, Foundation::RenderCore::ResourceHandle &outLinearSampler, Foundation::RenderCore::ResourceHandle &outNearestSampler)
Definition ImGui.cpp:331
void ImGui_ImplFoundation_ProcessEvent(SDL_Event *event)
Processes one SDL event and forwards it to ImGui.
Definition ImGui.cpp:50
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)
Definition ImGui.cpp:196
void ImGui_ImplFoundation_Init(Foundation::RHI::RHIDevice *device, SDL_Window *window)
Definition ImGui.cpp:32
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)
Definition ImGui.cpp:220
Definition Command.hpp:35
Definition Device.hpp:162
Definition Resource.hpp:191
Renderer implementing a Frame Graph system with automatic resource tracking and synchronization.
Definition Renderer.hpp:78
PassHandle CreatePass(StringView name, RHIDeviceQueueType queue, size_t priority, FSetup &&setup, FRecord &&record, FSkip &&skip={})
Create a render pass from a Setup(Renderer*, PassHandle) and Record(Renderer*, PassHandle,...
Definition Renderer.hpp:351
std::basic_string_view< char > StringView
Alias for std::basic_string_view<char>
Definition Container.hpp:55
size_t ResourceHandle
Definition RenderPass.hpp:11
size_t PassHandle
Definition RenderPass.hpp:10
Definition Allocator.hpp:5