-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved parallelism and examples (#4)
- Reworked cutting example - removed parallelisme on sticks - new demo gif - Fixed examples windows
- Loading branch information
1 parent
bae5624
commit 4f3e02a
Showing
15 changed files
with
116 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use crate::{VerletPoint, VerletStick}; | ||
use bevy::log; | ||
use bevy::prelude::*; | ||
use bevy_prototype_debug_lines::DebugLines; | ||
|
||
macro_rules! get_point_debug { | ||
($res:expr) => { | ||
match $res { | ||
Ok(p) => p, | ||
Err(e) => { | ||
log::warn!("Could not find point entity to draw debug stick: {}", e); | ||
return None; | ||
} | ||
} | ||
}; | ||
} | ||
|
||
#[cfg(feature = "debug")] | ||
fn draw_stick( | ||
stick: &VerletStick, | ||
points_query: &Query<&Transform, With<VerletPoint>>, | ||
) -> Option<(Vec3, Vec3)> { | ||
let transform_a = get_point_debug!(points_query.get(stick.point_a_entity)); | ||
let transform_b = get_point_debug!(points_query.get(stick.point_b_entity)); | ||
Some((transform_a.translation, transform_b.translation)) | ||
} | ||
|
||
#[cfg(feature = "debug")] | ||
pub fn debug_draw_sticks( | ||
mut lines: ResMut<DebugLines>, | ||
sticks_query: Query<&VerletStick>, | ||
points_query: Query<&Transform, With<VerletPoint>>, | ||
) { | ||
for stick in sticks_query.iter() { | ||
if let Some((a, b)) = draw_stick(stick, &points_query) { | ||
lines.line(a, b, 0.); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
#[cfg(feature = "debug")] | ||
pub(crate) mod debug; | ||
pub mod points; | ||
pub mod sticks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.