VisuTwin Canvas
C++ 3D Engine — Metal Backend
Loading...
Searching...
No Matches
visutwin::canvas::ImGuiOverlay Class Reference

#include <viz/overlay/imguiOverlay.h>

Public Member Functions

void beginFrame ()
 Begin a new ImGui frame. Call once per frame before building any UI.
void endFrame ()
 ImGuiOverlay ()=default
 ImGuiOverlay (const ImGuiOverlay &)=delete
 ImGuiOverlay (ImGuiOverlay &&) noexcept
void init (MetalGraphicsDevice *device, SDL_Window *window)
bool isInitialized () const
 Whether the overlay has been initialized.
void label3D (const Vector3 &worldPos, const char *text, const Color &color=Color(0.94f, 0.96f, 0.98f, 0.95f))
ImGuiOverlayoperator= (const ImGuiOverlay &)=delete
ImGuiOverlayoperator= (ImGuiOverlay &&) noexcept
void panelLabel3D (const Vector3 &worldPos, const char *title, const char *body, const Color &panelColor=Color(0.06f, 0.09f, 0.16f, 0.88f))
 Render a text label with a background panel anchored to a 3D world position.
bool processEvent (const SDL_Event &event)
void renderToGPU ()
void setViewProjection (const Matrix4 &vp)
 Set the current frame's view-projection matrix (needed for worldToScreen).
void setWindowSize (int width, int height)
 Set the current window dimensions (needed for NDC→screen conversion).
void shutdown ()
 Shut down ImGui and release all resources.
bool wantCaptureKeyboard () const
 True if ImGui wants exclusive keyboard input (an ImGui text field is active).
bool wantCaptureMouse () const
 True if ImGui wants exclusive mouse input (cursor is over an ImGui window).
 ~ImGuiOverlay ()

Static Public Member Functions

static void applyDigitalTwinTheme ()
 Apply the digital twin dark glassmorphism theme.

Detailed Description

Definition at line 42 of file imguiOverlay.h.

Constructor & Destructor Documentation

◆ ImGuiOverlay() [1/3]

visutwin::canvas::ImGuiOverlay::ImGuiOverlay ( )
default

◆ ~ImGuiOverlay()

visutwin::canvas::ImGuiOverlay::~ImGuiOverlay ( )

Definition at line 35 of file imguiOverlay.cpp.

References shutdown().

◆ ImGuiOverlay() [2/3]

visutwin::canvas::ImGuiOverlay::ImGuiOverlay ( const ImGuiOverlay & )
delete

References ImGuiOverlay().

◆ ImGuiOverlay() [3/3]

visutwin::canvas::ImGuiOverlay::ImGuiOverlay ( ImGuiOverlay && other)
noexcept

Definition at line 42 of file imguiOverlay.cpp.

References ImGuiOverlay().

Member Function Documentation

◆ applyDigitalTwinTheme()

void visutwin::canvas::ImGuiOverlay::applyDigitalTwinTheme ( )
static

Apply the digital twin dark glassmorphism theme.

Definition at line 271 of file imguiOverlay.cpp.

Referenced by init().

◆ beginFrame()

void visutwin::canvas::ImGuiOverlay::beginFrame ( )

Begin a new ImGui frame. Call once per frame before building any UI.

Definition at line 120 of file imguiOverlay.cpp.

Referenced by operator=().

◆ endFrame()

void visutwin::canvas::ImGuiOverlay::endFrame ( )

Finalize the ImGui frame and generate draw lists. Call after all ImGui::Begin/End calls are done.

Definition at line 142 of file imguiOverlay.cpp.

Referenced by operator=().

◆ init()

void visutwin::canvas::ImGuiOverlay::init ( MetalGraphicsDevice * device,
SDL_Window * window )

Initialize ImGui context, Metal backend, SDL3 backend, and theme. Call once after creating the graphics device and SDL window.

Definition at line 72 of file imguiOverlay.cpp.

References applyDigitalTwinTheme().

Referenced by operator=().

◆ isInitialized()

bool visutwin::canvas::ImGuiOverlay::isInitialized ( ) const
inline

Whether the overlay has been initialized.

Definition at line 84 of file imguiOverlay.h.

References isInitialized().

Referenced by isInitialized().

◆ label3D()

void visutwin::canvas::ImGuiOverlay::label3D ( const Vector3 & worldPos,
const char * text,
const Color & color = Color(0.94f, 0.96f, 0.98f, 0.95f) )

Render a text label anchored to a 3D world position. The label is projected to screen space using the current view-projection. Call between beginFrame() and endFrame().

Definition at line 223 of file imguiOverlay.cpp.

References visutwin::canvas::Color::a, visutwin::canvas::Color::b, visutwin::canvas::Color::g, and visutwin::canvas::Color::r.

◆ operator=() [1/2]

ImGuiOverlay & visutwin::canvas::ImGuiOverlay::operator= ( const ImGuiOverlay & )
delete

◆ operator=() [2/2]

ImGuiOverlay & visutwin::canvas::ImGuiOverlay::operator= ( ImGuiOverlay && other)
noexcept

Definition at line 55 of file imguiOverlay.cpp.

References ImGuiOverlay(), and shutdown().

◆ panelLabel3D()

void visutwin::canvas::ImGuiOverlay::panelLabel3D ( const Vector3 & worldPos,
const char * title,
const char * body,
const Color & panelColor = Color(0.06f, 0.09f, 0.16f, 0.88f) )

Render a text label with a background panel anchored to a 3D world position.

Definition at line 239 of file imguiOverlay.cpp.

References visutwin::canvas::Color::a.

◆ processEvent()

bool visutwin::canvas::ImGuiOverlay::processEvent ( const SDL_Event & event)

Forward an SDL event to ImGui for input handling. Call this inside the SDL_PollEvent loop, BEFORE your own event handlers. Returns true if ImGui consumed the event (you can skip your own handling).

Definition at line 102 of file imguiOverlay.cpp.

Referenced by operator=().

◆ renderToGPU()

void visutwin::canvas::ImGuiOverlay::renderToGPU ( )

Encode ImGui draw data into a Metal command buffer targeting the frame's drawable. Call between endFrame() and the present.

Definition at line 148 of file imguiOverlay.cpp.

Referenced by operator=().

◆ setViewProjection()

void visutwin::canvas::ImGuiOverlay::setViewProjection ( const Matrix4 & vp)
inline

Set the current frame's view-projection matrix (needed for worldToScreen).

Definition at line 89 of file imguiOverlay.h.

◆ setWindowSize()

void visutwin::canvas::ImGuiOverlay::setWindowSize ( int width,
int height )
inline

Set the current window dimensions (needed for NDC→screen conversion).

Definition at line 92 of file imguiOverlay.h.

◆ shutdown()

void visutwin::canvas::ImGuiOverlay::shutdown ( )

Shut down ImGui and release all resources.

Definition at line 186 of file imguiOverlay.cpp.

Referenced by operator=(), operator=(), and ~ImGuiOverlay().

◆ wantCaptureKeyboard()

bool visutwin::canvas::ImGuiOverlay::wantCaptureKeyboard ( ) const

True if ImGui wants exclusive keyboard input (an ImGui text field is active).

Definition at line 114 of file imguiOverlay.cpp.

Referenced by operator=().

◆ wantCaptureMouse()

bool visutwin::canvas::ImGuiOverlay::wantCaptureMouse ( ) const

True if ImGui wants exclusive mouse input (cursor is over an ImGui window).

Definition at line 108 of file imguiOverlay.cpp.

Referenced by operator=().


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