Skip to content

Commit

Permalink
Merge pull request #68 from Azkellas/update-egui-glam
Browse files Browse the repository at this point in the history
Update egui to 0.28 and glam to 0.28
  • Loading branch information
urholaukkarinen authored Jul 7, 2024
2 parents 58b8ac3 + bbdf2a4 commit a30088d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ transform-gizmo = { version = "0.2.0", path = "crates/transform-gizmo" }
transform-gizmo-egui = { version = "0.2.0", path = "crates/transform-gizmo-egui" }
transform-gizmo-bevy = { version = "0.2.0", path = "crates/transform-gizmo-bevy" }

egui = "0.27.2"
eframe = "0.27.2"
emath = "0.27.2"
epaint = "0.27.2"
ecolor = "0.27.2"
glam = { version = "0.27.0", features = ["mint"] }
egui = "0.28.0"
eframe = "0.28.0"
emath = "0.28.0"
epaint = "0.28.0"
ecolor = "0.28.0"
glam = { version = "0.28.0", features = ["mint"] }
mint = "0.5"
enum_dispatch = "0.3.12"
ahash = "0.8.7"
Expand Down
27 changes: 16 additions & 11 deletions crates/transform-gizmo/src/shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::f64::consts::TAU;
use crate::math::{Pos2, Rect};
use ecolor::Color32;
use epaint::{Mesh, TessellationOptions, Tessellator, TextureId};
pub(crate) use epaint::{Shape, Stroke};
pub(crate) use epaint::{PathStroke, Shape, Stroke};
use glam::{DMat4, DVec3};

use crate::math::world_to_screen;
Expand Down Expand Up @@ -69,7 +69,7 @@ impl ShapeBuidler {
radius: f64,
start_angle: f64,
end_angle: f64,
stroke: impl Into<Stroke>,
stroke: impl Into<PathStroke>,
) -> Mesh {
let mut points = self.arc_points(radius, start_angle, end_angle);

Expand All @@ -81,29 +81,34 @@ impl ShapeBuidler {

self.tessellate_shape(if closed {
points.pop();
Shape::closed_line(points, stroke)
Shape::closed_line(points, stroke.into())
} else {
Shape::line(points, stroke)
Shape::line(points, stroke.into())
})
}

pub(crate) fn circle(&self, radius: f64, stroke: impl Into<Stroke>) -> Mesh {
pub(crate) fn circle(&self, radius: f64, stroke: impl Into<PathStroke>) -> Mesh {
self.arc(radius, 0.0, TAU, stroke)
}

pub(crate) fn filled_circle(
&self,
radius: f64,
color: Color32,
stroke: impl Into<Stroke>,
stroke: impl Into<PathStroke>,
) -> Mesh {
let mut points = self.arc_points(radius, 0.0, TAU);
points.pop();

self.tessellate_shape(Shape::convex_polygon(points, color, stroke.into()))
}

pub(crate) fn line_segment(&self, from: DVec3, to: DVec3, stroke: impl Into<Stroke>) -> Mesh {
pub(crate) fn line_segment(
&self,
from: DVec3,
to: DVec3,
stroke: impl Into<PathStroke>,
) -> Mesh {
let mut points: [Pos2; 2] = Default::default();

for (i, point) in points.iter_mut().enumerate() {
Expand Down Expand Up @@ -131,7 +136,7 @@ impl ShapeBuidler {
Shape::convex_polygon(
vec![start - cross, start + cross, end],
stroke.color,
Stroke::NONE,
PathStroke::NONE,
)
} else {
Shape::Noop
Expand All @@ -142,7 +147,7 @@ impl ShapeBuidler {
&self,
points: &[DVec3],
fill: impl Into<Color32>,
stroke: impl Into<Stroke>,
stroke: impl Into<PathStroke>,
) -> Mesh {
let points = points
.iter()
Expand All @@ -156,7 +161,7 @@ impl ShapeBuidler {
})
}

pub(crate) fn polyline(&self, points: &[DVec3], stroke: impl Into<Stroke>) -> Mesh {
pub(crate) fn polyline(&self, points: &[DVec3], stroke: impl Into<PathStroke>) -> Mesh {
let points = points
.iter()
.filter_map(|pos| world_to_screen(self.viewport, self.mvp, *pos))
Expand All @@ -175,7 +180,7 @@ impl ShapeBuidler {
start_angle: f64,
end_angle: f64,
fill: impl Into<Color32>,
stroke: impl Into<Stroke>,
stroke: impl Into<PathStroke>,
) -> Mesh {
let angle_delta = end_angle - start_angle;
let step_count = steps(angle_delta.abs());
Expand Down
4 changes: 2 additions & 2 deletions examples/egui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ impl eframe::App for ExampleApp {
}
}

fn main() -> eframe::Result<()> {
fn main() -> eframe::Result {
eframe::run_native(
"transform_gizmo_egui example",
NativeOptions::default(),
Box::new(|_| Box::new(ExampleApp::new())),
Box::new(|_| Ok(Box::new(ExampleApp::new()))),
)
}

0 comments on commit a30088d

Please sign in to comment.