diff options
| author | Sébastien Crozet <developer@crozet.re> | 2021-01-29 14:42:32 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-29 14:42:32 +0100 |
| commit | 7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c (patch) | |
| tree | 3781b9d7c92a6a8111573ba4cae1c5d41435950e /src_testbed/harness/mod.rs | |
| parent | e6fc8f67faf3e37afe38d683cbd930d457f289be (diff) | |
| parent | 825f33efaec4ce6a8903751e836a0ea9c466ff92 (diff) | |
| download | rapier-7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c.tar.gz rapier-7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c.tar.bz2 rapier-7ca46f38cde6cf8bf8bf41ea6067ae5bc938205c.zip | |
Merge pull request #79 from dimforge/split_geom
Move most of the geometric code to another crate.
Diffstat (limited to 'src_testbed/harness/mod.rs')
| -rw-r--r-- | src_testbed/harness/mod.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src_testbed/harness/mod.rs b/src_testbed/harness/mod.rs index 2251038..afdc23a 100644 --- a/src_testbed/harness/mod.rs +++ b/src_testbed/harness/mod.rs @@ -14,7 +14,6 @@ pub mod plugin; pub struct RunState { #[cfg(feature = "parallel")] pub thread_pool: rapier::rayon::ThreadPool, - #[cfg(feature = "parallel")] pub num_threads: usize, pub timestep_id: usize, pub time: f32, @@ -24,6 +23,8 @@ impl RunState { pub fn new() -> Self { #[cfg(feature = "parallel")] let num_threads = num_cpus::get_physical(); + #[cfg(not(feature = "parallel"))] + let num_threads = 1; #[cfg(feature = "parallel")] let thread_pool = rapier::rayon::ThreadPoolBuilder::new() @@ -34,7 +35,6 @@ impl RunState { Self { #[cfg(feature = "parallel")] thread_pool: thread_pool, - #[cfg(feature = "parallel")] num_threads, timestep_id: 0, time: 0.0, @@ -67,21 +67,12 @@ type Callbacks = Vec< #[allow(dead_code)] impl Harness { pub fn new_empty() -> Self { - #[cfg(feature = "parallel")] - let num_threads = num_cpus::get_physical(); - - #[cfg(feature = "parallel")] - let thread_pool = rapier::rayon::ThreadPoolBuilder::new() - .num_threads(num_threads) - .build() - .unwrap(); - let contact_channel = crossbeam::channel::unbounded(); let proximity_channel = crossbeam::channel::unbounded(); let event_handler = ChannelEventCollector::new(proximity_channel.0, contact_channel.0); let events = PhysicsEvents { contact_events: contact_channel.1, - proximity_events: proximity_channel.1, + intersection_events: proximity_channel.1, }; let physics = PhysicsState::new(); let state = RunState::new(); @@ -111,6 +102,10 @@ impl Harness { &mut self.physics.integration_parameters } + pub fn clear_callbacks(&mut self) { + self.callbacks.clear(); + } + pub fn physics_state_mut(&mut self) -> &mut PhysicsState { &mut self.physics } |
