Skip to content

Instantly share code, notes, and snippets.

@doughsay
Created July 23, 2017 22:28
Show Gist options
  • Save doughsay/ef9c48b25e3a86ff12039a552e408e66 to your computer and use it in GitHub Desktop.
Save doughsay/ef9c48b25e3a86ff12039a552e408e66 to your computer and use it in GitHub Desktop.
Chunk meshing algorithm
for each y going from -1 to MAX_Y:
for each x going from -1 to MAX_X:
if (x, y) is air:
if (x, y + 1) is NOT air:
draw a south facing wall at (x, y + 1)
if (x + 1, y) is NOT air:
draw a west facing wall at (x + 1, y)
else:
if (x, y + 1) IS air:
draw a north facing wall at (x, y)
if (x + 1, y) IS air:
draw an east facing wall at (x, y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment