Crate transform_gizmo_egui

Source
Expand description

Provides a 3D transformation gizmo for the Egui library.

transform-gizmo-egui provides a feature-rich and configurable gizmo that can be used for 3d transformations (translation, rotation, scale).

§Usage

Create a new Gizmo instance once.

use transform_gizmo_egui::prelude::*;

let gizmo = Gizmo::default();

Update the gizmo configuration as needed, for example, when the camera moves.

gizmo.update_config(GizmoConfig {
    view_matrix: view_matrix.into(),
    projection_matrix: projection_matrix.into(),
    modes: GizmoMode::all(),
    orientation: GizmoOrientation::Local,
    ..Default::default()
});

Finally, interact with the gizmo. The function takes a slice of transforms as an input. The result is Some if the gizmo was successfully interacted with this frame. In the result you can find the modified transforms, in the same order as was given to the function as arguments.

 let mut transform = Transform::from_scale_rotation_translation(scale, rotation, translation);

 if let Some((result, new_transforms)) = gizmo.interact(ui, &[transform]) {
     for (new_transform, transform) in
         new_transforms.iter().zip(std::iter::once(&mut transform))
     {
         // Apply the modified transforms
         *transform = *new_transform;
     }
 }

Modules§

config
gizmo
math
mint
Mint - Math interoperability standard types.
prelude

Macros§

enum_set
Creates a EnumSet literal, which can be used in const contexts.

Structs§

Color32
This format is used for space-efficient color representation (32 bits).
EnumSet
An efficient set type for enums.
Gizmo
A 3D transformation gizmo.
GizmoConfig
Configuration of a gizmo.
GizmoDrawData
Data used to draw Gizmo.
GizmoInteraction
Information needed for interacting with the gizmo.
GizmoVisuals
Controls the visual style of the gizmo
Rect
A rectangular region of space.

Enums§

GizmoDirection
GizmoMode
Operation mode of a gizmo.
GizmoOrientation
Orientation of a gizmo.
GizmoResult
Result of a gizmo transformation

Traits§

GizmoExt