class mola::MolaVizImGuiCore

Overview

Core rendering and state-management logic for the Dear ImGui MOLA viz backend.

Implements VizInterface so it can be used anywhere a VizInterface::Ptr is expected without going through the full MolaVizImGui MOLA module.

Two operating modes:

  • Host mode (MolaVizImGui): a companion class creates a GLFW window and ImGui context on a dedicated thread and calls render_frame() each frame.

  • Embed mode : the caller already owns the GLFW window and ImGui context. After calling init_for_embed() once (GL context current, no ImGui frame open), the caller invokes spin_one_frame() each frame between ImGui::NewFrame() and ImGui::Render(). The 3-D background scene is NOT rendered by the core in this mode; the caller renders it via its own CImGuiSceneView using the scene returned by get_background_scene().

#include <MolaVizImGuiCore.h>

class MolaVizImGuiCore:
    public mola::VizInterface,
    public mrpt::system::COutputLogger
{
public:
    // typedefs

    typedef std::function<void(const mrpt::rtti::CObject::Ptr&, void*subWinHandle, const window_name_t&parentWin, const std::string&subWindowTitle, MolaVizImGuiCore*instance, const mrpt::containers::yaml*extra_parameters)> update_handler_t;
    typedef std::string class_name_t;
    typedef std::string window_name_t;
    typedef std::string subwindow_name_t;
    typedef std::vector<std::function<void()>> task_queue_t;

    // structs

    struct DecayingCloud;
    struct PerWindowData;
    struct PlotWindowState;
    struct SubWindowState;

    // fields

    bool show_rgbd_as_point_cloud_ = false;
    double assumed_sensor_rate_hz_ = 10.0;
    int target_fps_ = 60;
    std::string imgui_app_name_ = "default";
    bool console_enabled_ = true;
    unsigned int console_max_entries_ = 5000;
    double console_window_seconds_ = 120.0;
    std::atomic<mrpt::system::VerbosityLevel> console_capture_level_ {mrpt::system::LVL_INFO};
    std::shared_ptr<ConsoleLogSink> console_sink_ = std::make_shared<ConsoleLogSink>();
    bool menu_bar_enabled_ = true;
    std::function<void()> quit_callback_;
    bool plots_enabled_ = true;
    double plots_default_retention_seconds_ = 10.0;
    double plots_default_span_seconds_ = 5.0;
    std::shared_ptr<MetricsRegistry> metrics_;
    static const window_name_t DEFAULT_WINDOW_NAME = "main";
    std::map<window_name_t, PerWindowData> windows_;
    task_queue_t guiThreadPendingTasks_;
    std::mutex guiThreadPendingTasksMtx_;
    std::map<window_name_t, std::string> imgui_ini_paths_;

    // construction

    MolaVizImGuiCore();
    MolaVizImGuiCore(const MolaVizImGuiCore&);
    MolaVizImGuiCore(MolaVizImGuiCore&&);

    // methods

    void register_gui_cleanup(const std::function<void()>& cleanup);
    void run_registered_cleanups();

    static void register_gui_handler(
        const class_name_t& name,
        const update_handler_t& handler
        );

    void init_for_embed(const window_name_t& name = DEFAULT_WINDOW_NAME);
    void shutdown_for_embed();

    PerWindowData& init_window(
        const window_name_t& name,
        GLFWwindow* win
        );

    void spin_one_frame(const window_name_t& name = DEFAULT_WINDOW_NAME);
    void render_frame(const window_name_t& name, PerWindowData& wd);
    std::shared_ptr<mrpt::opengl::COpenGLScene> get_background_scene(const window_name_t& name = DEFAULT_WINDOW_NAME);
    std::mutex* get_background_scene_mutex(const window_name_t& name = DEFAULT_WINDOW_NAME);

    std::future<bool> clear_background_scene(
        const std::string& viewportName = "main",
        const window_name_t& parentWindow = DEFAULT_WINDOW_NAME
        );

    static std::shared_ptr<MolaVizImGuiCore> make_for_embed();
    virtual const std::string& gui_backend() const;
    virtual std::future<void> create_subwindow_from_description(const mola::gui::WindowDescription& desc, const std::string& parentWindow = DEFAULT_WINDOW_NAME);
    virtual std::future<void> enqueue_custom_gui_code(const std::function<void()>& userCode);

    virtual void* get_subwindow_handle(
        const std::string& subWindowTitle,
        const std::string& parentWindow = DEFAULT_WINDOW_NAME
        );

    virtual std::future<std::optional<std::string>> open_file_dialog(
        const std::string& title,
        bool save,
        const std::vector<std::pair<std::string, std::string>>& filters = {},
        const std::string& default_path = "",
        const std::string& parentWindow = DEFAULT_WINDOW_NAME
        );

    virtual std::future<void> set_menu_bar(const mola::gui::MenuBar& bar, const std::string& parentWindow = DEFAULT_WINDOW_NAME);
    virtual MetricChannel::Ptr register_metric(const std::string& name, const std::string& unit = "");
    virtual void push_metric(const std::string& name, double t, double value);

    virtual std::future<bool> update_3d_object(
        const std::string& objName,
        const std::shared_ptr<mrpt::opengl::CSetOfObjects>& obj,
        const std::string& viewportName = "main",
        const std::string& parentWindow = DEFAULT_WINDOW_NAME,
        const std::string& parentFrame = ""
        );

    virtual std::future<bool> update_3d_object_frame(
        const std::string& frameName,
        const mrpt::math::TPose3D& pose,
        const std::string& viewportName = "main",
        const std::string& parentWindow = DEFAULT_WINDOW_NAME
        );

    virtual std::future<bool> insert_point_cloud_with_decay(
        const std::shared_ptr<mrpt::opengl::CPointCloudColoured>& cloud,
        double decay_time_seconds,
        const std::string& viewportName = "main",
        const std::string& parentWindow = DEFAULT_WINDOW_NAME,
        const std::string& parentFrame = ""
        );

    virtual std::future<bool> clear_all_point_clouds_with_decay(
        const std::string& viewportName = "main",
        const std::string& parentWindow = DEFAULT_WINDOW_NAME
        );

    virtual std::future<bool> update_viewport_look_at(
        const mrpt::math::TPoint3Df& lookAt,
        const std::string& viewportName = "main",
        const std::string& parentWindow = DEFAULT_WINDOW_NAME,
        const std::string& parentFrame = ""
        );

    virtual std::future<bool> update_viewport_camera_azimuth(
        double azimuth,
        bool absolute_falseForRelative = true,
        const std::string& viewportName = "main",
        const std::string& parentWindow = DEFAULT_WINDOW_NAME
        );

    virtual std::future<bool> update_viewport_camera_orthographic(
        bool orthographic,
        const std::string& viewportName = "main",
        const std::string& parentWindow = DEFAULT_WINDOW_NAME
        );

    virtual std::future<bool> execute_custom_code_on_background_scene(
        const std::function<void(mrpt::opengl::Scene&)>& userCode,
        const std::string& parentWindow = DEFAULT_WINDOW_NAME
        );

    virtual std::future<bool> subwindow_update_visualization(
        const mrpt::rtti::CObject::Ptr& obj,
        const std::string& subWindowTitle,
        const mrpt::containers::yaml* extra_parameters = nullptr,
        const std::string& parentWindow = DEFAULT_WINDOW_NAME
        );

    virtual std::future<bool> output_console_message(
        const std::string& message,
        const std::string& parentWindow = DEFAULT_WINDOW_NAME
        );

    MolaVizImGuiCore& operator = (const MolaVizImGuiCore&);
    MolaVizImGuiCore& operator = (MolaVizImGuiCore&&);
    std::string resolve_imgui_ini_path(const window_name_t& windowName) const;
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<VizInterface> Ptr;

    // methods

    virtual std::future<void> create_subwindow_from_description(
        const mola::gui::WindowDescription& desc,
        const std::string& parentWindow = "main"
        ) = 0;

    virtual std::future<void> enqueue_custom_gui_code(const std::function<void()>& userCode) = 0;
    virtual const std::string& gui_backend() const = 0;

    virtual std::future<void> set_menu_bar(
        const mola::gui::MenuBar& bar,
        const std::string& parentWindow = "main"
        ) = 0;

    virtual void* get_subwindow_handle(
        const std::string& subWindowTitle,
        const std::string& parentWindow = "main"
        ) = 0;

    virtual std::future<bool> update_3d_object(
        const std::string& objName,
        const std::shared_ptr<mrpt::opengl::CSetOfObjects>& obj,
        const std::string& viewportName = "main",
        const std::string& parentWindow = "main",
        const std::string& parentFrame = ""
        ) = 0;

    virtual std::future<bool> update_3d_object_frame(
        const std::string& frameName,
        const mrpt::math::TPose3D& pose,
        const std::string& viewportName = "main",
        const std::string& parentWindow = "main"
        ) = 0;

    virtual std::future<bool> insert_point_cloud_with_decay(
        const std::shared_ptr<mrpt::opengl::CPointCloudColoured>& cloud,
        double decay_time_seconds,
        const std::string& viewportName = "main",
        const std::string& parentWindow = "main",
        const std::string& parentFrame = ""
        ) = 0;

    virtual std::future<bool> clear_all_point_clouds_with_decay(
        const std::string& viewportName = "main",
        const std::string& parentWindow = "main"
        ) = 0;

    virtual std::future<bool> update_viewport_look_at(
        const mrpt::math::TPoint3Df& lookAt,
        const std::string& viewportName = "main",
        const std::string& parentWindow = "main",
        const std::string& parentFrame = ""
        ) = 0;

    virtual std::future<bool> update_viewport_camera_azimuth(
        double azimuth,
        bool absolute_falseForRelative = true,
        const std::string& viewportName = "main",
        const std::string& parentWindow = "main"
        ) = 0;

    virtual std::future<bool> update_viewport_camera_orthographic(
        bool orthographic,
        const std::string& viewportName = "main",
        const std::string& parentWindow = "main"
        ) = 0;

    virtual std::future<bool> execute_custom_code_on_background_scene(
        const std::function<void(mrpt::opengl::Scene&)>& userCode,
        const std::string& parentWindow = "main"
        ) = 0;

    virtual std::future<bool> subwindow_update_visualization(
        const mrpt::rtti::CObject::Ptr& obj,
        const std::string& subWindowTitle,
        const mrpt::containers::yaml* extra_parameters = nullptr,
        const std::string& parentWindow = "main"
        ) = 0;

    virtual std::future<bool> output_console_message(
        const std::string& msg,
        const std::string& parentWindow = "main"
        ) = 0;

    virtual std::future<std::optional<std::string>> open_file_dialog(
        const std::string& title,
        bool save,
        const std::vector<std::pair<std::string, std::string>>& filters = {},
        const std::string& default_path = "",
        const std::string& parentWindow = "main"
        ) = 0;

    virtual MetricChannel::Ptr register_metric(const std::string& name, const std::string& unit = "") = 0;
    virtual void push_metric(const std::string& name, double t, double value) = 0;
    VizInterface& operator = (const VizInterface&);
    VizInterface& operator = (VizInterface&&);

Fields

std::string imgui_app_name_ = "default"

Identifier used to key the imgui .ini persistence file. Empty string disables persistence. See MolaVizImGui docs.

bool console_enabled_ = true

Console subwindow: master enable. When false, no log interception and the Console window is not shown.

unsigned int console_max_entries_ = 5000

Max number of captured log entries kept in the rolling buffer.

double console_window_seconds_ = 120.0

Rolling time window (seconds): entries older than this are dropped.

std::atomic<mrpt::system::VerbosityLevel> console_capture_level_ {mrpt::system::LVL_INFO}

Verbosity threshold used when registering module log callbacks (i.e. what gets captured pipeline-wide, as opposed to console_level_enabled_ below, which only filters what the already-captured entries display). Default INFO: capturing DEBUG from every module forces every MRPT_LOG_DEBUG_STREAM() callsite in the whole pipeline to always format its message just to feed the sink, even if the UI ends up hiding it. Runtime-adjustable from the Console window’s “Capture” combo; atomic because it’s written from the GUI thread and read from the module’s own spin thread (see MolaVizImGui::console_check_new_modules()).

std::shared_ptr<ConsoleLogSink> console_sink_ = std::make_shared<ConsoleLogSink>()

Sink shared with the per-module logger callbacks; always allocated, populated only while console_enabled_ is true.

bool menu_bar_enabled_ = true

Top main menu bar (host mode only): master enable. When false, no menu bar is created at all (including the “MOLA” and built-in “View” menus, and any module-installed menu via set_menu_bar()). Existing plot/console windows are unaffected; only the top strip and its menus disappear.

std::function<void()> quit_callback_

Invoked when the user clicks “Quit” in the “MOLA” menu (host mode only). Set by MolaVizImGui::initialize() to request shutdown of the whole MOLA application. Left unset (no-op) outside of that context, e.g. when the Core is driven directly in embed mode.

bool plots_enabled_ = true

Plot windows: master enable for the plot-window items in the “View” menu and metric registration. When false, register_metric() /push_metric() still return valid (no-op) channels so callers never need to guard the call.

double plots_default_retention_seconds_ = 10.0

Default rolling-history cap (seconds) for a newly-registered channel.

double plots_default_span_seconds_ = 5.0

Default horizontal span (seconds) of a newly-created plot window.

std::shared_ptr<MetricsRegistry> metrics_

Registry of metric channels shared with the per-module producer handles; always allocated, like console_sink_. See MetricsRegistry.h.

Methods

void register_gui_cleanup(const std::function<void()>& cleanup)

Register a cleanup callback on this instance. The callback is called (with the GL context current) during shutdown_for_embed() / destruction and should release any GL handles this instance allocated. Multiple callbacks may be registered; they are called in registration order.

void run_registered_cleanups()

Run all cleanup callbacks registered on this instance. Must be called with the GL context current.

void init_for_embed(const window_name_t& name = DEFAULT_WINDOW_NAME)

Embed mode: register a virtual window (no GLFW window) keyed by name. Must be called once per window-name with the GL context current, before spin_one_frame(). Calling twice with the same name is a no-op (returns without overwriting existing sub-windows / sensor windows).

void shutdown_for_embed()

Embed mode: release GL resources held by registered handlers and clear internal scene state. MUST be called by the host while the GL context is still current, before destroying the ImGui/GL context. Safe to call more than once. If the destructor runs without a prior call, a warning is logged (GL state may leak / crash on shutdown).

void spin_one_frame(const window_name_t& name = DEFAULT_WINDOW_NAME)

Embed mode: drain the task queue and render all MOLA sub-windows into the caller’s active ImGui frame. Background 3-D scene rendering is skipped — the caller is responsible for that. Must be called between ImGui::NewFrame() and ImGui::Render().

void render_frame(const window_name_t& name, PerWindowData& wd)

Host mode: full per-frame render for a GLFW-owned window. Calls glfwMakeContextCurrent, begins a new ImGui frame, runs all sub-renderers (background scene, sub-windows, sensor windows, console overlay), and finishes with ImGui::Render + glfwSwapBuffers.

std::shared_ptr<mrpt::opengl::COpenGLScene> get_background_scene(const window_name_t& name = DEFAULT_WINDOW_NAME)

Expose the shared OpenGL scene written to by MOLA observation handlers. An external CImGuiSceneView (embed mode) can render it directly. Returns nullptr if name is not registered.

Thread-safety: must be called from the GUI thread (the same thread that calls spin_one_frame() / render_frame()). Reads of the returned scene contents on the GUI thread must hold get_background_scene_mutex() for the duration of access — VizInterface writers also lock it.

std::mutex* get_background_scene_mutex(const window_name_t& name = DEFAULT_WINDOW_NAME)

Returns the mutex guarding get_background_scene(). Returns nullptr if name is not registered. Same thread-safety note as get_background_scene().

std::future<bool> clear_background_scene(
    const std::string& viewportName = "main",
    const window_name_t& parentWindow = DEFAULT_WINDOW_NAME
    )

Removes every object from a viewport of the background scene.

Unlike update_3d_object() (which only touches the single named object it is given) or clear_all_point_clouds_with_decay() (limited to the decay container), this is a full reset of the viewport contents.

static std::shared_ptr<MolaVizImGuiCore> make_for_embed()

Embed mode: heap-allocate a core and return it as a VizInterface::Ptr. Preferred over constructing on the stack/as a member, because MOLA modules (e.g. mola_lidar_odometry) consume a VizInterface::Ptr and the host must guarantee the instance outlives them. The returned pointer can also be dynamic_pointer_cast<MolaVizImGuiCore> to reach embed-specific APIs.

Caller must still invoke init_for_embed() once the GL context is current, and shutdown_for_embed() while it is still current.

virtual const std::string& gui_backend() const

Returns a short identifier string for the active GUI backend.

Clients may use this to conditionally tune their GUIs - for example to choose between an Entypo icon (nanogui) and a FontAwesome codepoint (ImGui), or to skip features not yet supported on a given backend.

Canonical values are provided as static constants below: VizInterface::BACKEND_NANOGUI → “nanogui” VizInterface::BACKEND_IMGUI → “imgui”

Comparison example:

if (visualizer_->gui_backend() == VizInterface::BACKEND_IMGUI) { ... }

The method is pure virtual so each concrete backend is forced to declare its identity explicitly. It is noexcept and const so it is safe to call from any context, including hot loops.

virtual std::future<void> create_subwindow_from_description(
    const mola::gui::WindowDescription& desc,
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

Creates a sub-window described by a GuiWidgetDescription.

The description carries the window title, initial position/size hints, tab structure, and all widget definitions including their initial values and on_change callbacks.

The returned future resolves once the window has been created in the GUI thread and all widgets are live. Callers that need to know when construction is complete should call .get() on the future.

Position and size in the description are treated as first-use hints :

  • nanogui backend : applied unconditionally via setPosition/setFixedWidth.

  • ImGui backend : passed as ImGuiCond_FirstUseEver, so the dock manager and imgui.ini take over from the second run.

Label text is updated at any time and from any thread by calling LiveString::set() on the LiveString instances embedded in the description. The backend polls them on each frame / spinOnce tick.

Parameters:

desc

Full window and widget description.

parentWindow

Name of the parent host window (default: “main”).

Returns:

future<void> that resolves when the window is live.

See also:

mola::gui::WindowDescription, mola::gui::LiveString

virtual std::future<void> enqueue_custom_gui_code(const std::function<void()>& userCode)

Enqueues arbitrary code to run on the GUI thread at the next available opportunity.

Use this for any GUI-thread work that is not covered by the widget description API: e.g. updating widget enable/disable state, changing slider ranges at runtime, or interacting with toolkit-specific objects via a cast of the opaque handle returned by get_subwindow_handle().

The callable is executed in the GUI thread; do not call blocking operations inside it.

This replaces the deprecated enqueue_custom_nanogui_code().

virtual void* get_subwindow_handle(
    const std::string& subWindowTitle,
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

Returns an opaque handle to a previously created sub-window.

The handle type depends on the backend:

Returns nullptr if the window does not exist yet or the backend does not support retained window objects.

This is an intentional “escape hatch” for toolkit-specific code that cannot be expressed through the description API. Prefer enqueue_custom_gui_code() over casting this pointer wherever possible, as that keeps the calling module’s cpp file free of GUI toolkit headers.

virtual std::future<std::optional<std::string>> open_file_dialog(
    const std::string& title,
    bool save,
    const std::vector<std::pair<std::string, std::string>>& filters = {},
    const std::string& default_path = "",
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

Opens a modal file-picker dialog on the GUI thread.

The call is non-blocking: it enqueues the dialog to open on the GUI thread and returns a future that resolves when the user dismisses it.

Parameters:

title

Dialog window title, e.g. “Open point cloud”.

save

true → “Save as” dialog (prompts before overwrite). false → “Open” dialog (validates file exists).

filters

List of {description, comma-separated-extensions} pairs. Example: {{“LAS files”,”las,laz”},{“All files”,”*”}} Pass an empty vector to show all files.

default_path

Initial directory or full path suggestion. Empty string means the backend’s default (usually the current working directory).

parentWindow

Host window name.

Returns:

future resolving to the chosen absolute path, or std::nullopt if the user cancelled.

virtual std::future<void> set_menu_bar(
    const mola::gui::MenuBar& bar,
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

Installs or replaces the menu bar of a parent window.

Menu bars are a first-class feature of the Dear ImGui docking branch (ImGui::BeginMainMenuBar / BeginMenuBar). The nanogui backend has no native equivalent and provides a no-op stub that resolves the future immediately without rendering anything. Callers should guard with gui_backend() if the menus are essential to their workflow:

if (visualizer_->gui_backend() == VizInterface::BACKEND_IMGUI)
    visualizer_->set_menu_bar(bar);

Parameters:

bar

Full menu bar description.

parentWindow

Host window whose menu bar is replaced.

Returns:

future<void> resolving when the menu bar is live.

virtual MetricChannel::Ptr register_metric(const std::string& name, const std::string& unit = "")

Registers (or returns the existing) metric channel by unique name.

Idempotent: repeated calls with the same name return the same channel.

Parameters:

name

Unique id, also the default legend label. Use a namespaced form like “lidar_odom/icp_delay_ms” to avoid collisions.

unit

Optional unit string shown on axis/legend (e.g. “ms”, “%”).

Returns:

A channel handle; never null (no-op handle on backends without plotting).

virtual void push_metric(const std::string& name, double t, double value)

One-shot convenience: register-if-needed then push.

For rarely-updated metrics; prefer holding the handle returned by register_metric() on hot paths to avoid a name lookup per sample.

virtual std::future<bool> update_3d_object(
    const std::string& objName,
    const std::shared_ptr<mrpt::opengl::CSetOfObjects>& obj,
    const std::string& viewportName = "main",
    const std::string& parentWindow = DEFAULT_WINDOW_NAME,
    const std::string& parentFrame = ""
    )

Updates or inserts a 3D object in the background scene.

The update is performed in the GUI thread. If the named object already exists, its contents are replaced by copying the shared pointers inside obj.

Parameters:

objName

Name used to identify the object (upsert key).

obj

Object to display.

viewportName

Viewport inside the parent window.

parentWindow

Host window name.

parentFrame

Optional name of a movable reference-frame node previously created via update_3d_object_frame(). When non-empty, the object is attached as a child of that frame (so moving the frame moves the object without re-rendering it); the frame node is auto-created at the identity pose if it does not exist yet. Empty (default) attaches to the viewport root, as before.

Returns:

future<bool>; resolves to true when executed.

virtual std::future<bool> update_3d_object_frame(
    const std::string& frameName,
    const mrpt::math::TPose3D& pose,
    const std::string& viewportName = "main",
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

Creates or repositions a named movable “reference frame” node.

A frame node is an (initially empty) container placed at the viewport root. Objects can be attached to it via the parentFrame argument of update_3d_object(); moving the frame then relocates all attached objects at once, without re-uploading their geometry. This is how a back end such as mola_mapper_3d keeps a front end’s dense clouds / local map (drawn once in its own {odom_i} frame) correctly placed in {map} as it estimates the T_map_to_odom_i transform online.

Idempotent: the first call creates the node; later calls only update its pose, preserving any already-attached children.

Parameters:

frameName

Name of the frame node (upsert key). Must be non-empty.

pose

Pose of the frame in the viewport (i.e. in {map}).

viewportName

Viewport inside the parent window.

parentWindow

Host window name.

Returns:

future<bool>; resolves to true when executed.

virtual std::future<bool> insert_point_cloud_with_decay(
    const std::shared_ptr<mrpt::opengl::CPointCloudColoured>& cloud,
    double decay_time_seconds,
    const std::string& viewportName = "main",
    const std::string& parentWindow = DEFAULT_WINDOW_NAME,
    const std::string& parentFrame = ""
    )

Inserts a temporary point cloud visible for decay_time_seconds.

Parameters:

cloud

Cloud to display.

decay_time_seconds

Lifetime in seconds before the cloud fades out.

viewportName

Target viewport.

parentWindow

Host window name.

parentFrame

If non-empty, the cloud is attached as a child of the named movable frame node (same semantics as the parentFrame argument of update_3d_object()).

Returns:

future<bool> resolving to true when executed.

virtual std::future<bool> clear_all_point_clouds_with_decay(
    const std::string& viewportName = "main",
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

Removes all clouds previously inserted with insert_point_cloud_with_decay().

virtual std::future<bool> update_viewport_look_at(
    const mrpt::math::TPoint3Df& lookAt,
    const std::string& viewportName = "main",
    const std::string& parentWindow = DEFAULT_WINDOW_NAME,
    const std::string& parentFrame = ""
    )

Moves the viewport camera look-at point.

Parameters:

lookAt

Target point in the local coordinate frame of parentFrame (if given) or in world/scene space.

parentFrame

If non-empty, the backend looks up the named movable frame node, applies its current scene pose to lookAt, and uses the resulting world-space point as the target. This makes the camera follow a vehicle rendered under a frame node rather than chasing its odom-frame coords.

virtual std::future<bool> update_viewport_camera_azimuth(
    double azimuth,
    bool absolute_falseForRelative = true,
    const std::string& viewportName = "main",
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

Rotates the viewport camera around the vertical axis.

Parameters:

azimuth

Angle in radians.

absolute_falseForRelative

true → set absolute azimuth; false → add increment to current value.

virtual std::future<bool> update_viewport_camera_orthographic(
    bool orthographic,
    const std::string& viewportName = "main",
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

Switches the viewport camera between perspective and orthographic.

virtual std::future<bool> execute_custom_code_on_background_scene(
    const std::function<void(mrpt::opengl::Scene&)>& userCode,
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

Executes arbitrary user code on the mrpt::opengl::Scene of the background viewport.

Use this to modify viewport properties, add sub-viewports, change background colour, etc. The callable runs in the GUI thread.

This method operates on the mrpt OpenGL scene, not on GUI toolkit widgets, so it is backend-agnostic: both nanogui and ImGui backends embed an mrpt scene in their OpenGL canvas.

virtual std::future<bool> subwindow_update_visualization(
    const mrpt::rtti::CObject::Ptr& obj,
    const std::string& subWindowTitle,
    const mrpt::containers::yaml* extra_parameters = nullptr,
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

Updates a sub-window’s content from an MRPT object.

The correct handler is selected based on the runtime type of obj. Custom handlers can be registered via MolaViz::register_gui_handler().

Returns:

future<bool> resolving to false if no handler exists for the object’s type.

virtual std::future<bool> output_console_message(
    const std::string& message,
    const std::string& parentWindow = DEFAULT_WINDOW_NAME
    )

No-op on this backend: superseded by the dockable Console subwindow, which aggregates mrpt-logger output directly.