|
GREM 3.12.0
Game/Rendering Engine Modules for C++
|
Persistent system that manages a platform+renderer backend for Dear ImGui. More...
#include <GREM/imgui/GraphicalUserInterface.hpp>
Classes | |
| struct | Vertex |
| Data layout for the attributes of a single vertex of a GUI. More... | |
| struct | VertexShaderConstants |
| Struct of GUI vertex shader constants. More... | |
| struct | VertexShaderOutputs |
| Struct of fields output by a GUI vertex shader. More... | |
| struct | ViewParameters |
| Struct of shader parameters representing the view of a GUI. More... | |
| struct | FragmentShaderConstants |
| Struct of GUI fragment shader constants. More... | |
| struct | FragmentShaderOutputs |
| Struct of fields output by a GUI fragment shader. More... | |
| struct | TextureParameters |
| Struct of shader parameters representing the texture of a GUI. More... | |
Public Types | |
| using | TextureID = uint64_t |
| Identifier for a texture used by the Dear ImGui backend. | |
| using | Index = uint16_t |
| Data type used in the index buffer of a GUI. | |
| using | Mesh = graphics::Mesh<Vertex, Index> |
| Mesh type of the GUI. | |
| using | ViewParameterBuffer = graphics::UniformBuffer<ViewParameters, "GUIViewParameters"> |
| Shader buffer for GUI view parameters. | |
| using | VertexShader = graphics::VertexShader<Mesh, VertexShaderConstants, VertexShaderOutputs, ViewParameterBuffer> |
| Default vertex shader for drawing a GUI. | |
| using | TextureBuffer = graphics::UniformBuffer<TextureParameters, "GUITexture"> |
| Shader buffer for GUI texture parameters. | |
| using | FragmentShader = graphics::FragmentShader<Mesh, VertexShaderOutputs, FragmentShaderConstants, FragmentShaderOutputs, ViewParameterBuffer, TextureBuffer> |
| Default fragment shader for drawing a GUI. | |
| using | ShaderPipeline = graphics::ShaderPipeline<Mesh> |
| Shader pipeline for drawing a GUI. | |
Public Member Functions | |
| GraphicalUserInterface (Filesystem &filesystem, events::EventPump &eventPump, graphics::Window &window, graphics::Device &device, graphics::Swapchain &swapchain, graphics::Renderer2D &renderer2D, const GraphicalUserInterfaceOptions &options={}) | |
| Construct a graphical user interface. | |
| GraphicalUserInterface (Filesystem &filesystem, events::EventPump &eventPump, graphics::Window &window, graphics::Device &device, graphics::Swapchain &swapchain, graphics::Renderer2D &renderer2D, ImGuiContext &context, const GraphicalUserInterfaceOptions &options={}) | |
| Construct a graphical user interface for an existing Dear ImGui context. | |
| ~GraphicalUserInterface () | |
| Destructor. | |
| GraphicalUserInterface (const GraphicalUserInterface &)=delete | |
| Copying a GUI is not allowed. | |
| GraphicalUserInterface (GraphicalUserInterface &&)=delete | |
| Moving a GUI is not allowed. | |
| GraphicalUserInterface & | operator= (const GraphicalUserInterface &)=delete |
| Copying a GUI is not allowed. | |
| GraphicalUserInterface & | operator= (GraphicalUserInterface &&)=delete |
| Moving a GUI is not allowed. | |
| bool | handleEvent (const events::Event &event) |
| Handle an event from an events::EventPump in the GUI. | |
| void | update (Duration deltaTime) |
| Prepare for a new GUI frame. | |
| void | drawFrame (graphics::RenderPass &renderPass, const ImDrawData &drawData, SharedPointer< graphics::ShaderPipelineImplementation > shaderPipelineOverrideHandle={}) |
| Push the draw commands of a GUI frame to a render pass. | |
| void | drawFrame (graphics::RenderPass &renderPass, const ImDrawData &drawData, const ShaderPipeline &shaderPipelineOverride) |
| Push the draw commands of a GUI frame to a render pass. | |
| TextureID | getTextureID (const graphics::Texture &texture) |
| Create a texture ID for a texture that will be valid for rendering in the GUI until at least the next call to update() after the texture has been destroyed, by extending the lifetime of the texture. | |
| ImGuiContext * | getContext () const noexcept |
| Get the underlying Dear ImGui context. | |
| const VertexShader & | getDefaultVertexShader () |
| Get the default GUI vertex shader. | |
| const FragmentShader & | getPlainFragmentShader () |
| Get the default plain GUI fragment shader. | |
| const ShaderPipeline & | getPlainShaderPipeline () |
| Get the default plain GUI shader pipeline. | |
Static Public Member Functions | |
| static graphics::Window & | getWindow (ImGuiViewport &viewport) |
| Get the window associated with an ImGui viewport. | |
| static graphics::Swapchain & | getSwapchain (ImGuiViewport &viewport) |
| Get the swapchain associated with an ImGui viewport. | |
Static Public Attributes | |
| static constexpr VertexShaderConstants | DEFAULT_VERTEX_SHADER_CONSTANTS {} |
| Default GUI vertex shader constants. | |
| static constexpr FragmentShaderConstants | DEFAULT_FRAGMENT_SHADER_CONSTANTS {} |
| Default GUI fragment shader constants. | |
| static constexpr graphics::ShaderPipelineOptions | DEFAULT_SHADER_PIPELINE_OPTIONS |
| Default GUI graphics pipeline configuration. | |
Persistent system that manages a platform+renderer backend for Dear ImGui.
| using grem::imgui::GraphicalUserInterface::TextureID = uint64_t |
Identifier for a texture used by the Dear ImGui backend.
| using grem::imgui::GraphicalUserInterface::Index = uint16_t |
Data type used in the index buffer of a GUI.
Meets the requirements of the grem::graphics::mesh_index concept.
Mesh type of the GUI.
| using grem::imgui::GraphicalUserInterface::ViewParameterBuffer = graphics::UniformBuffer<ViewParameters, "GUIViewParameters"> |
Shader buffer for GUI view parameters.
| using grem::imgui::GraphicalUserInterface::VertexShader = graphics::VertexShader<Mesh, VertexShaderConstants, VertexShaderOutputs, ViewParameterBuffer> |
Default vertex shader for drawing a GUI.
| using grem::imgui::GraphicalUserInterface::TextureBuffer = graphics::UniformBuffer<TextureParameters, "GUITexture"> |
Shader buffer for GUI texture parameters.
| using grem::imgui::GraphicalUserInterface::FragmentShader = graphics::FragmentShader<Mesh, VertexShaderOutputs, FragmentShaderConstants, FragmentShaderOutputs, ViewParameterBuffer, TextureBuffer> |
Default fragment shader for drawing a GUI.
Shader pipeline for drawing a GUI.
| grem::imgui::GraphicalUserInterface::GraphicalUserInterface | ( | Filesystem & | filesystem, |
| events::EventPump & | eventPump, | ||
| graphics::Window & | window, | ||
| graphics::Device & | device, | ||
| graphics::Swapchain & | swapchain, | ||
| graphics::Renderer2D & | renderer2D, | ||
| const GraphicalUserInterfaceOptions & | options = {} ) |
Construct a graphical user interface.
| filesystem | filesystem to create the GUI for. Must outlive the GUI. |
| eventPump | event pump to create the GUI for. Must outlive the GUI. |
| window | main window to create the GUI for. Must outlive the GUI. |
| device | device to create the GUI for. Must be associated with the given window. Must outlive the GUI. |
| swapchain | swapchain associated with the main window. Must be associated with the given window and device. Must outlive the GUI. |
| renderer2D | renderer to create the GUI for. Must be associated with the given device. Must outlive the GUI. |
| options | initial configuration of the graphical user interface, see GraphicalUserInterfaceOptions. |
| imgui::Error | on failure to initialize the GUI. |
| std::bad_alloc | on allocation failure. |
| grem::imgui::GraphicalUserInterface::GraphicalUserInterface | ( | Filesystem & | filesystem, |
| events::EventPump & | eventPump, | ||
| graphics::Window & | window, | ||
| graphics::Device & | device, | ||
| graphics::Swapchain & | swapchain, | ||
| graphics::Renderer2D & | renderer2D, | ||
| ImGuiContext & | context, | ||
| const GraphicalUserInterfaceOptions & | options = {} ) |
Construct a graphical user interface for an existing Dear ImGui context.
| filesystem | filesystem to create the GUI for. Must outlive the GUI. |
| eventPump | event pump to create the GUI for. Must outlive the GUI. |
| window | main window to create the GUI for. Must outlive the GUI. |
| device | device to create the GUI for. Must be associated with the given window. Must outlive the GUI. |
| swapchain | swapchain associated with the main window. Must be associated with the given window and device. Must outlive the GUI. |
| renderer2D | renderer to create the GUI for. Must be associated with the given device. Must outlive the GUI. |
| context | Dear ImGui context to use for this GUI. Must outlive the GUI. |
| options | initial configuration of the graphical user interface, see GraphicalUserInterfaceOptions. |
| imgui::Error | on failure to initialize the GUI. |
| std::bad_alloc | on allocation failure. |
| grem::imgui::GraphicalUserInterface::~GraphicalUserInterface | ( | ) |
Destructor.
|
delete |
Copying a GUI is not allowed.
|
delete |
Moving a GUI is not allowed.
|
staticnodiscard |
Get the window associated with an ImGui viewport.
| viewport | ImGui viewport to get the window of. Must be a viewport created from this GUI's context. |
|
staticnodiscard |
Get the swapchain associated with an ImGui viewport.
| viewport | ImGui viewport to get the swapchain of. Must be a viewport created from this GUI's context. |
|
delete |
Copying a GUI is not allowed.
|
delete |
Moving a GUI is not allowed.
| bool grem::imgui::GraphicalUserInterface::handleEvent | ( | const events::Event & | event | ) |
Handle an event from an events::EventPump in the GUI.
| event | event to handle. |
| void grem::imgui::GraphicalUserInterface::update | ( | Duration | deltaTime | ) |
Prepare for a new GUI frame.
| deltaTime | time elapsed between the beginning of the previous frame and the beginning of the new frame. |
| imgui::Error | on failure to prepare a new frame. |
| graphics::Error | if graphics resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
| void grem::imgui::GraphicalUserInterface::drawFrame | ( | graphics::RenderPass & | renderPass, |
| const ImDrawData & | drawData, | ||
| SharedPointer< graphics::ShaderPipelineImplementation > | shaderPipelineOverrideHandle = {} ) |
Push the draw commands of a GUI frame to a render pass.
| renderPass | render pass to push the draw commands to. |
| drawData | GUI frame to draw, obtained using ImGui::GetDrawData() after calling ImGui::Render(). Must have been rendered with the context of this GUI. |
| shaderPipelineOverrideHandle | shader pipeline override to use, or nullptr to not use a shader override. |
| imgui::Error | on failure to draw the frame. |
| graphics::Error | if graphics resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
|
inline |
Push the draw commands of a GUI frame to a render pass.
| renderPass | render pass to push the draw commands to. |
| drawData | GUI frame to draw, obtained using ImGui::GetDrawData() after calling ImGui::Render(). Must have been rendered with the context of this GUI. |
| shaderPipelineOverride | shader pipeline override to use. |
| imgui::Error | on failure to draw the frame. |
| graphics::Error | if graphics resource creation failed. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
|
nodiscard |
Create a texture ID for a texture that will be valid for rendering in the GUI until at least the next call to update() after the texture has been destroyed, by extending the lifetime of the texture.
| texture | texture to create an ID for. |
| std::length_error | if an internal size limit was exceeded. |
| std::bad_array_new_length | if an internal size limit was exceeded. |
| std::bad_alloc | on allocation failure. |
|
nodiscardnoexcept |
Get the underlying Dear ImGui context.
|
nodiscard |
Get the default GUI vertex shader.
|
nodiscard |
Get the default plain GUI fragment shader.
|
nodiscard |
Get the default plain GUI shader pipeline.
|
staticconstexpr |
Default GUI vertex shader constants.
|
staticconstexpr |
Default GUI fragment shader constants.
|
staticconstexpr |
Default GUI graphics pipeline configuration.