|
|
@ -12,7 +12,7 @@ pub trait BloxelStore<T: Copy> { |
|
|
|
pub trait BloxelStoreMut<T: Copy>: BloxelStore<T> { |
|
|
|
pub trait BloxelStoreMut<T: Copy>: BloxelStore<T> { |
|
|
|
fn set(&mut self, pos: IVec3, value: T) -> Result<T, ()>; |
|
|
|
fn set(&mut self, pos: IVec3, value: T) -> Result<T, ()>; |
|
|
|
|
|
|
|
|
|
|
|
fn update(&mut self, f: impl Fn(IVec3, T) -> T) { |
|
|
|
fn update(&mut self, mut f: impl FnMut(IVec3, T) -> T) { |
|
|
|
let (w, h, d) = self.size().into(); |
|
|
|
let (w, h, d) = self.size().into(); |
|
|
|
for prod in Hom3FCartProd::new(0..w, 0..h, 0..d) { |
|
|
|
for prod in Hom3FCartProd::new(0..w, 0..h, 0..d) { |
|
|
|
let pos = UVec3::from(prod).as_ivec3(); |
|
|
|
let pos = UVec3::from(prod).as_ivec3(); |
|
|
|