parallel grid deposit
This commit is contained in:
@@ -88,6 +88,8 @@ pub struct Grid {
|
||||
// Scratch space for the blur operation.
|
||||
buf: Vec<f32>,
|
||||
blur: Blur,
|
||||
|
||||
pub i: Vec<usize>,
|
||||
}
|
||||
|
||||
impl Clone for Grid {
|
||||
@@ -99,13 +101,14 @@ impl Clone for Grid {
|
||||
data: self.data.clone(),
|
||||
buf: self.buf.clone(),
|
||||
blur: self.blur.clone(),
|
||||
i: self.i.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Grid {
|
||||
// Create a new grid filled with random floats in the [0.0..1.0) range.
|
||||
pub fn new<R: Rng + ?Sized>(width: usize, height: usize, rng: &mut R) -> Self {
|
||||
pub fn new<R: Rng + ?Sized>(width: usize, height: usize, rng: &mut R, i: Vec<usize>) -> Self {
|
||||
if !width.is_power_of_two() || !height.is_power_of_two() {
|
||||
panic!("Grid dimensions must be a power of two.");
|
||||
}
|
||||
@@ -119,6 +122,7 @@ impl Grid {
|
||||
config: PopulationConfig::new(rng),
|
||||
buf: vec![0.0; width * height],
|
||||
blur: Blur::new(width),
|
||||
i,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user