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