This project is a lightweight, self-contained library for gizmo editing commonly found in many game engines. It includes mechanisms for manipulating 3d position, rotation, and scale. Implemented in C++11, the library does not perform rendering directly and instead provides a per-frame buffer of world-space triangles.
An included example is built on top of GLFW (with an OpenGL 3.3 context). Known limitations include hardcoded assumptions about a right-handed, Y-up coordinate system. While the gizmos are provided with vertex normals, the example does not perform any fancy shading. Furthermore, mouse-drag input with certain gizmos at extreme interaction grazing angles is known to produce anomalous output.
This project was born out of mild frustration with other immediate-mode gizmo libraries. Instead of 4x4 matrices and euler angles, the library exposes a
rigid_transform consisting of a 3d position, rotation quaternion, and scale. The library is implemented in around 1200 lines of code, which also includes a complete 3d math library in ~400 LoC - linalg.h. Alternatives include ImGuizmo and Im3D. Tinygizmo fits in-between these projects by being fully self-contained (no dependency on Dear ImGui), and by being provided in the public domain.
- Both axis-aligned global and object-local transform modes for translational and rotational gizmos
- Optional ability draw the gizmos with a constant screen-space scale
- Snap-to-unit (both linear and angular)
- Set any of the
snap_values in the
- Set any of the
- VR ready (the user must call
draw()for each eye)
- Hotkeys for transitioning between translation, rotation, and scaling:
ctrl-tto activate the translation gizmo
ctrl-rto activate the rotation gizmo
ctrl-sto activate the scale gizmo
ctrl-lto toggle between global and local transform modes
This project would not have been possible without reference implementations in the public-domain workbench project.
This is free and unencumbered software released into the public domain. For more information, please refer to http://unlicense.org