diff --git a/rust/src/boid_properties.rs b/rust/src/boid/boid_properties.rs similarity index 86% rename from rust/src/boid_properties.rs rename to rust/src/boid/boid_properties.rs index aa34e8a..aebd960 100644 --- a/rust/src/boid_properties.rs +++ b/rust/src/boid/boid_properties.rs @@ -28,4 +28,8 @@ pub struct BoidProperties { #[init(val = 0.8)] /// How much to follow a flock target (if there is one). pub targeting: f32, + #[export] + #[init(val = 1.0)] + /// How much to avoid avoidance objects (if there are any). + pub avoidance: f32, } diff --git a/rust/src/boid/mod.rs b/rust/src/boid/mod.rs index 2e46a16..e41d0e8 100644 --- a/rust/src/boid/mod.rs +++ b/rust/src/boid/mod.rs @@ -4,10 +4,15 @@ use std::sync::Arc; use glam::*; use rayon::prelude::*; -use crate::{BoidProperties, FlockProperties}; +use crate::FlockProperties; pub mod boid_2d; pub mod boid_3d; +pub mod boid_properties; + +pub use boid_2d::*; +pub use boid_3d::*; +pub use boid_properties::*; pub trait Boid { fn apply_force(&mut self, force: Vec3); diff --git a/rust/src/flock_properties.rs b/rust/src/flock/flock_properties.rs similarity index 100% rename from rust/src/flock_properties.rs rename to rust/src/flock/flock_properties.rs diff --git a/rust/src/flock/mod.rs b/rust/src/flock/mod.rs index 0ee1a90..a7b4380 100644 --- a/rust/src/flock/mod.rs +++ b/rust/src/flock/mod.rs @@ -1,10 +1,15 @@ -use crate::{BoidProperties, FlockProperties}; - use glam::*; +use crate::BoidProperties; + +pub mod flock_properties; pub mod flock_2d; pub mod flock_3d; +pub use flock_properties::*; +pub use flock_2d::*; +pub use flock_3d::*; + pub trait Flock { fn get_flock_properties(&self) -> &FlockProperties; fn get_target_position(&self) -> Option; diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 1732711..c978f7e 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -9,15 +9,12 @@ use godot::{ use indexmap::IndexMap; use rayon::prelude::*; +mod obstacle; mod boid; -mod boid_properties; mod flock; -mod flock_properties; -pub use boid::{boid_2d::*, boid_3d::*, Boid}; -pub use boid_properties::BoidProperties; -pub use flock::{flock_2d::*, flock_3d::*, Flock}; -pub use flock_properties::FlockProperties; +pub use boid::{*, Boid}; +pub use flock::{*, Flock}; use rustc_hash::FxBuildHasher;