-
-
Notifications
You must be signed in to change notification settings - Fork 73
Open
Labels
prio:mediumMedium priorityMedium prioritystatus:todoTask identified but not startedTask identified but not startedtype:featNew feature or requestNew feature or request
Description
Feature description
This feature proposes adding a Gizmo Tool to implot3d, allowing users to intuitively manipulate data points or objects directly within the plot area. Instead of relying on external sliders or input fields, users can drag interactive handles to translate, rotate, or scale elements.
Key Requirements:
- Modes: Support for Translation (arrows), Rotation (rings), and Scaling (cubes/bars).
- 3D View: A full 3-axis gizmo is rendered when navigating in 3D.
- 2D View: When the plot is in a 2D view mode (e.g., restricted to a plane or
ImPlot3DFlags_GroundOnly), the gizmo should automatically adapt to a 2D version (e.g., hiding the Z-axis handles when viewing the XY plane). - Immediate Mode: The API should follow the immediate mode paradigm, taking pointers to position, rotation, and scale variables to update them in real-time.
Proposed API:
// Renders a gizmo and updates the transform values based on user input
bool PlotGizmo(const char* label_id, float* translation, float* rotation, float* scale, ImPlot3DGizmoFlags flags = 0);Tasks
- Public API (
implot3d.h)- Define
ImPlot3DGizmoFlags(e.g.,Translate,Rotate,Scale,Local,World). - Declare the
PlotGizmofunction.
- Define
- Rendering Logic (
implot3d_gizmo.cpp)- Implement rendering primitives for gizmo axes (lines/arrows for translation, circles for rotation, blocks for scale).
- Ensure gizmo renders on top of plot items (depth disable or end-of-frame rendering).
- Implement logic to detect the current view state (
plane_2dvs 3D) and hide irrelevant axes for the 2D view.
- Interaction Logic (
implot3d_gizmo.cpp)- Implement raycasting to detect mouse hovers over specific gizmo handles.
- Calculate mouse delta projected onto the active transformation axis/plane.
- Apply the calculated delta to the user's
translation,rotation, orscalearrays.
- Demo (
implot3d_demo.cpp)- Create a demo tab "Gizmo" showing a simple meshes (e.g., cube, duck) that can be manipulated using the new tool.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
prio:mediumMedium priorityMedium prioritystatus:todoTask identified but not startedTask identified but not startedtype:featNew feature or requestNew feature or request