Expand description
Provides a 3d transformation gizmo that can be used to manipulate 4x4 transformation matrices. Such gizmos are commonly used in applications such as game engines and 3d modeling software.
§Creating a gizmo
For a more complete example, see the online demo at https://urholaukkarinen.github.io/egui-gizmo/. The demo sources can be found at https://github.com/urholaukkarinen/egui-gizmo/blob/main/demo/src/main.rs.
§A basic example
let gizmo = Gizmo::new("My gizmo")
.view_matrix(view_matrix)
.projection_matrix(projection_matrix)
.model_matrix(model_matrix)
.mode(GizmoMode::Rotate);
if let Some(response) = gizmo.interact(ui) {
model_matrix = response.transform();
}
The gizmo can be placed inside a container such as a egui::Window
or an egui::Area
.
By default, the gizmo will use the ui clip rect as a viewport.
The gizmo will apply transformations to the given model matrix.
Structs§
- Gizmo
- Gizmo
Result - Result of an active transformation
- Gizmo
Visuals - Controls the visual style of the gizmo
Enums§
Constants§
- DEFAULT_
SNAP_ ANGLE - The default snapping distance for rotation in radians
- DEFAULT_
SNAP_ DISTANCE - The default snapping distance for translation
- DEFAULT_
SNAP_ SCALE - The default snapping distance for scale