Skip to content
This repository has been archived by the owner on Dec 27, 2023. It is now read-only.

Commit

Permalink
Merge pull request #3 from duaneking/main
Browse files Browse the repository at this point in the history
Fix overflow, reformat that code to better show math operations
  • Loading branch information
Adamkob12 authored Nov 26, 2023
2 parents 2f827c5 + 7038180 commit fd69045
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/chunk/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ pub(crate) fn cull_sides_of_mesh(
let adj_chunk_grid = { chunks_query.get(adj_chunk).unwrap().grid };
for svox in iter_faces_of_chunk(dims, face) {
let adj_voxel_ind = match face {
Right => svox - WIDTH + 1,
Left => svox + WIDTH - 1,
Back => svox - WIDTH * (LENGTH - 1),
Forward => svox + WIDTH * (LENGTH - 1),
Right => if svox < WIDTH {1} else {(svox - WIDTH) + 1},
Left => (svox + WIDTH) - 1,
Back => svox - (WIDTH * (LENGTH - 1)),
Forward => svox + (WIDTH * (LENGTH - 1)),
_ => panic!("Shouldn't happen"),
};

Expand Down

0 comments on commit fd69045

Please sign in to comment.