Skip to content

Instantly share code, notes, and snippets.

View kanelbulle's full-sized avatar

Emil Arfvidsson kanelbulle

  • Google
  • Mountain View, USA
View GitHub Profile
private Vector3f normalForVoxel(int x, int y, int z, Vector3f normal) {
float numAdded = 0;
normal.set(0, 0, 0);
// Iterate through the 26 neighbors of the voxel
for (int xd = -1; xd < 2; xd++) {
for (int yd = -1; yd < 2; yd++) {
for (int zd = -1; zd < 2; zd++) {
int xoff = x + xd;
int yoff = y + yd;