Skip to content

Commit

Permalink
use version of edges crate that exposes march_edges appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
shnewto committed Mar 4, 2024
1 parent 01dc9be commit 7e654e2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ keywords = ["bevy", "rapier", "png", "collider", "2d"]
readme = "README.md"

[features]
default = ["xpbd_2d","rapier2d"]
default = ["xpbd_2d", "rapier2d"]
xpbd_2d = ["dep:bevy_xpbd_2d"]
rapier2d = ["dep:bevy_rapier2d"]

[dependencies]
bevy = "0.13.0"
bevy_rapier2d = { version = "0.25.0", optional = true }
bevy_xpbd_2d = { version = "0.4.2", optional = true }
edges = { version = "0.2.0", features = ["bevy"]}
edges = { version = "0.3.0", features = ["bevy"] }
thiserror = "1.0.57"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/collider/rapier2d.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use edges::Edges;
use bevy::prelude::{Image, Vec2};
use bevy_rapier2d::prelude::{Collider, Real};
use edges::Edges;

/// Generate a single bevy_rapier2d polyline collider from the image,
/// coordinates translated to either side of (0, 0)
Expand Down
8 changes: 5 additions & 3 deletions src/collider/xpbd_2d.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use edges::Edges;
use bevy::prelude::{Image, Vec2};
use bevy_xpbd_2d::{
math::Vector2,
Expand All @@ -9,6 +8,7 @@ use bevy_xpbd_2d::{
},
prelude::Collider,
};
use edges::Edges;

/// Generate a single polyline collider from the image,
/// coordinates translated to either side of (0, 0)
Expand All @@ -28,7 +28,8 @@ pub fn single_polyline_collider_raw(image: &Image) -> Collider {
/// coordinates translated to either side of (0, 0)
pub fn single_convex_polyline_collider_translated(image: &Image) -> Option<Collider> {
let e = Edges::from(image);
let points = e.single_image_edge_translated()
let points = e
.single_image_edge_translated()
.into_iter()
.map(Point::from)
.collect::<Vec<Point<Real>>>();
Expand All @@ -39,7 +40,8 @@ pub fn single_convex_polyline_collider_translated(image: &Image) -> Option<Colli
/// coordinates left alone and all in positive x and y
pub fn single_convex_polyline_collider_raw(image: &Image) -> Option<Collider> {
let e = Edges::from(image);
let points = e.single_image_edge_raw()
let points = e
.single_image_edge_raw()
.into_iter()
.map(Point::from)
.collect::<Vec<Point<Real>>>();
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ pub use collider::rapier2d;
#[cfg(feature = "xpbd_2d")]
pub use collider::xpbd_2d;

pub use::edges::Edges;
pub use ::edges::Edges;

0 comments on commit 7e654e2

Please sign in to comment.