refactor: move properties code under their respective directories

This commit is contained in:
dusk 2024-11-29 01:11:10 +03:00
parent 419019cfb0
commit fbe5d1644b
Signed by: dusk
SSH Key Fingerprint: SHA256:Abmvag+juovVufZTxyWY8KcVgrznxvBjQpJesv071Aw
5 changed files with 20 additions and 9 deletions

View File

@ -28,4 +28,8 @@ pub struct BoidProperties {
#[init(val = 0.8)] #[init(val = 0.8)]
/// How much to follow a flock target (if there is one). /// How much to follow a flock target (if there is one).
pub targeting: f32, pub targeting: f32,
#[export]
#[init(val = 1.0)]
/// How much to avoid avoidance objects (if there are any).
pub avoidance: f32,
} }

View File

@ -4,10 +4,15 @@ use std::sync::Arc;
use glam::*; use glam::*;
use rayon::prelude::*; use rayon::prelude::*;
use crate::{BoidProperties, FlockProperties}; use crate::FlockProperties;
pub mod boid_2d; pub mod boid_2d;
pub mod boid_3d; pub mod boid_3d;
pub mod boid_properties;
pub use boid_2d::*;
pub use boid_3d::*;
pub use boid_properties::*;
pub trait Boid { pub trait Boid {
fn apply_force(&mut self, force: Vec3); fn apply_force(&mut self, force: Vec3);

View File

@ -1,10 +1,15 @@
use crate::{BoidProperties, FlockProperties};
use glam::*; use glam::*;
use crate::BoidProperties;
pub mod flock_properties;
pub mod flock_2d; pub mod flock_2d;
pub mod flock_3d; pub mod flock_3d;
pub use flock_properties::*;
pub use flock_2d::*;
pub use flock_3d::*;
pub trait Flock { pub trait Flock {
fn get_flock_properties(&self) -> &FlockProperties; fn get_flock_properties(&self) -> &FlockProperties;
fn get_target_position(&self) -> Option<Vec3>; fn get_target_position(&self) -> Option<Vec3>;

View File

@ -9,15 +9,12 @@ use godot::{
use indexmap::IndexMap; use indexmap::IndexMap;
use rayon::prelude::*; use rayon::prelude::*;
mod obstacle;
mod boid; mod boid;
mod boid_properties;
mod flock; mod flock;
mod flock_properties;
pub use boid::{boid_2d::*, boid_3d::*, Boid}; pub use boid::{*, Boid};
pub use boid_properties::BoidProperties; pub use flock::{*, Flock};
pub use flock::{flock_2d::*, flock_3d::*, Flock};
pub use flock_properties::FlockProperties;
use rustc_hash::FxBuildHasher; use rustc_hash::FxBuildHasher;