Crate egui_gizmo

source ·
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.into();
}

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. Result of the gizmo interaction includes the transformed 4x4 model matrix as a 2-dimensional array.

Structs

Result of an active transformation
Controls the visual style of the gizmo

Enums

Constants

The default snapping distance for rotation in radians
The default snapping distance for translation
The default snapping distance for scale