Skip to content

Commit

Permalink
Reimplement the function using .iter_mut(), as some seem to find fo…
Browse files Browse the repository at this point in the history
…r-loops easier to understand than `core::array::from_fn`
  • Loading branch information
LikeLakers2 committed Jan 10, 2025
1 parent 4cdbca4 commit 53c979d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions crates/bevy_pbr/src/ssao/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -753,8 +753,15 @@ fn prepare_ssao_bind_groups(
}

fn generate_hilbert_index_lut() -> [[u16; 64]; 64] {
use core::array::from_fn;
from_fn(|x| from_fn(|y| hilbert_index(x as u16, y as u16)))
let mut t = [[0; 64]; 64];

for (x, array) in t.iter_mut().enumerate() {
for (y, item) in array.iter_mut().enumerate() {
*item = hilbert_index(x as u16, y as u16);
}
}

t
}

// https://www.shadertoy.com/view/3tB3z3
Expand Down

0 comments on commit 53c979d

Please sign in to comment.