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

Fix overflow, reformat that code to better show math operations #3

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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