cleanup Buf struct
This commit is contained in:
parent
75fab93907
commit
d1f515b17d
@ -1,13 +1,17 @@
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Buf {
|
pub struct Buf {
|
||||||
pub width: usize,
|
width: usize,
|
||||||
pub height: usize,
|
height: usize,
|
||||||
pub buf: Vec<f32>,
|
pub buf: Vec<f32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Buf {
|
impl Buf {
|
||||||
pub const fn new(width: usize, height: usize, buf: Vec<f32>) -> Self {
|
pub fn new(width: usize, height: usize) -> Self {
|
||||||
Buf { width, height, buf }
|
Buf {
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
buf: vec![0.0; height * width],
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Truncate x and y and return a corresponding index into the data slice.
|
// Truncate x and y and return a corresponding index into the data slice.
|
||||||
|
|||||||
@ -71,7 +71,7 @@ impl Grid {
|
|||||||
height,
|
height,
|
||||||
data,
|
data,
|
||||||
config: PopulationConfig::new(rng),
|
config: PopulationConfig::new(rng),
|
||||||
buf: Buf::new(width, height, vec![0.0; width * height]),
|
buf: Buf::new(width, height),
|
||||||
blur: Blur::new(width),
|
blur: Blur::new(width),
|
||||||
agents,
|
agents,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user