An immediate-mode 3D view gizmo for Dear ImGui, inspired by the navigation widgets found in Blender and Godot.
It provides an interactive axis widget you can click, drag, and snap to, making it easy to control camera orientation in 3D viewports.
- Immediate-mode API, following the same principles as Dear ImGui.
- Axis-aligned snapping with smooth animation.
- Camera orbit controls by dragging the gizmo.
- Fully customizable styles (colors, sizes, labels, highlight effects).
- Single-header implementation.
These examples assume you have your camera's position
(glm::vec3
) and rotation
(glm::quat
) available.
You start the interaction with
ImViewGuizmo::BeginFrame();
Renders the main orbit gizmo. Drag it to rotate the camera or click an axis to snap to a view.
if (ImViewGuizmo::Rotate(camera_position, camera_rotation, gizmoPos))
// Apply the updated state to your camera
Renders a zoom button. Click and drag it vertically to move the camera forward and backward.
if (ImViewGuizmo::Zoom(camera_position, camera_rotation, zoomButtonPos))
// Apply the updated state to your camera
Renders a pan button. Click and drag it to move (pan) the camera parallel to the view plane.
if (ImViewGuizmo::Pan(camera_position, camera_rotation, panButtonPos))
// Apply the updated state to your camera
This library requires the GLM (OpenGL Mathematics) library for its vector and matrix operations.
ImViewGuizmo is a single-header library. Simply add the header to your project:
// In exactly one source file:
#define IMVIEWGUIZMO_IMPLEMENTATION
#include "ImViewGuizmo.h"
// In all other places:
#include "ImViewGuizmo.h"
ImViewGuizmo is licensed under the MIT License, see LICENSE for more information.