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 <imgui.h>
6
7#include <RHICore/Device.hpp>
10
19// Upper half of ImTextureID stores metadata (i.e. sampler)
20static_assert(sizeof(ImTextureID) == 2 * sizeof(Foundation::Rendering::TexturePoolHandle));
21
22/* -- Internals -- */
23void ImGui_ImplFoundation_ImplUpdateTexture(ImTextureData* tex);
31 Foundation::RenderCore::Renderer* renderer, bool clear,
40// ^^^ Internals
41
42/* -- APIs -- */
53
60
67
76
82void ImGui_ImplFoundation_RemoveImage(ImTextureID textureID);
83
96template <typename FSetup>
98 bool clear, FSetup&& setup)
99{
100 using namespace Foundation;
101 using namespace RenderCore;
102 using namespace RHI;
103 ResourceHandle vtxBuffer, idxBuffer, linSampler, nearSampler;
104 ImGui_ImplFoundation_ImplCreateResources(renderer, vtxBuffer, idxBuffer, linSampler, nearSampler);
105 return createPass(
106 renderer, name, RHIDeviceQueueType::Graphics,
107 [=](PassHandle self, Renderer* r)
108 {
109 ImGui_ImplFoundation_ImplPassSetup(self, r, vtxBuffer, idxBuffer, linSampler, nearSampler);
110 setup(self, r);
111 },
112 [=](PassHandle self, Renderer* r, RHICommandList* cmd)
113 { ImGui_ImplFoundation_ImplPassRecord(self, r, clear, cmd, vtxBuffer, idxBuffer); });
114}
115
127
133// ^^^ APIs
void ImGui_ImplFoundation_NewFrame()
Starts a new ImGui frame.
Definition ImGui.cpp:52
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:129
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.
Definition ImGui.hpp:97
void ImGui_ImplFoundation_Init(Foundation::RHI::RHIDevice *device, Foundation::Native::NativeWindow *window, Foundation::Core::Allocator *allocator)
Definition ImGui.cpp:35
void ImGui_ImplFoundation_Shutdown()
Shuts down the ImGui backend and releases all resources.
Definition ImGui.cpp:57
void ImGui_ImplFoundation_SetupContextWithDefaultStyles()
Applies a default, vaguely stylish theme to the ImGui context.
Definition ImGui.cpp:296
void ImGui_ImplFoundation_ImplUpdateTexture(ImTextureData *tex)
Definition ImGui.cpp:78
void ImGui_ImplFoundation_RemoveImage(ImTextureID textureID)
Unregisters a texture from the ImGui backend.
Definition ImGui.cpp:135
ImGui_ImplFoundation_ImageSampler
Sampler type for added image.
Definition ImGui.hpp:15
@ ImGuiImplFoundationImageSamplerLinear
Definition ImGui.hpp:16
@ ImGuiImplFoundationImageSamplerNearest
Definition ImGui.hpp:17
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:276
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:152
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:176
General Purpose Allocator (GPA) interface.
Definition Allocator.hpp:24
Class representing a window for the platform.
Definition Application.hpp:15
Definition Command.hpp:34
Definition Device.hpp:131
Definition Resource.hpp:169
Renderer implementing a Frame Graph system with automatic resource tracking and synchronization.
Definition Renderer.hpp:78
std::basic_string_view< char > StringView
Alias for std::basic_string_view<char>
Definition Container.hpp:53
size_t ResourceHandle
Definition RenderPass.hpp:12
size_t PassHandle
Definition RenderPass.hpp:11
uint32_t TexturePoolHandle
Definition TexturePool.hpp:11
Definition Future.hpp:8
Default "no-op" functor for Setup()
Definition RenderPass.hpp:58