diff --git a/include/NodeRenderer.h b/include/NodeRenderer.h index 1501677..02e1179 100644 --- a/include/NodeRenderer.h +++ b/include/NodeRenderer.h @@ -24,7 +24,7 @@ class NodeRenderer glBegin(GL_QUADS); // Front - if(blockManager.mapBlocks[block.x][block.z].isAir(x, y, z - 1)) + if(blockManager.mapBlocks[block.x][block.z].isAir(x - block.x * 16, y, z - block.z * 16 - 1)) { glTexCoord2f(.0F, .0F); glVertex3f(x + .0F, y + 1.0F, z + .0F); @@ -40,7 +40,7 @@ class NodeRenderer } // Back - if(blockManager.mapBlocks[block.x][block.z].isAir(x, y, z + 1)) + if(blockManager.mapBlocks[block.x][block.z].isAir(x - block.x * 16, y, z - block.z * 16 + 1)) { glTexCoord2f(.0F, .0F); glVertex3f(x + .0F, y + 1.0F, z + 1.0F); @@ -56,7 +56,7 @@ class NodeRenderer } // Right - if(blockManager.mapBlocks[block.x][block.z].isAir(x + 1, y, z)) + if(blockManager.mapBlocks[block.x][block.z].isAir(x - block.x * 16 + 1, y, z - block.z * 16)) { glTexCoord2f(1.0F, .0F); glVertex3f(x + 1.0F, y + 1.0F, z + .0F); @@ -72,7 +72,7 @@ class NodeRenderer } // Left - if(blockManager.mapBlocks[block.x][block.z].isAir(x - 1, y, z)) + if(blockManager.mapBlocks[block.x][block.z].isAir(x - block.x * 16 - 1, y, z - block.z * 16)) { glTexCoord2f(1.0F, .0F); glVertex3f(x + .0F, y + 1.0F, z + .0F); @@ -88,7 +88,7 @@ class NodeRenderer } // Bottom - if(blockManager.mapBlocks[block.x][block.z].getNodeAt(x, y - 1, z) == 0) + if(blockManager.mapBlocks[block.x][block.z].getNodeAt(x - block.x * 16, y - 1, z - block.z * 16) == 0) { glTexCoord2f(.0F, .0F); glVertex3f(x + 1.0F, y + .0F, z + .0F); @@ -104,7 +104,7 @@ class NodeRenderer } // Top - if(blockManager.mapBlocks[block.x][block.z].getNodeAt(x, y + 1, z) == 0) + if(blockManager.mapBlocks[block.x][block.z].getNodeAt(x - block.x * 16, y + 1, z - block.z * 16) == 0) { glTexCoord2f(.0F, .0F); glVertex3f(x + 1.0F, y + 1.0F, z + .0F); diff --git a/main.cpp b/main.cpp index 67e85e4..b775fab 100644 --- a/main.cpp +++ b/main.cpp @@ -39,9 +39,9 @@ void display() glBegin(GL_QUADS); - for(int x = 0; x < 128; x++) + for(int x = 0; x < 64; x++) { - for(int z = 0; z < 128; z++) + for(int z = 0; z < 64; z++) { for(int y = 0; y < 256; y++) { @@ -176,7 +176,7 @@ int main(int argc, char **argv) { for(int y = 0; y < 16; y++) { - blockManager.mapBlocks[bx][bz].addNode(rand() % 3, 0, x, y, z); + blockManager.mapBlocks[bx][bz].addNode(1, 0, x, y, z); //printf("\nGet node at: %i\n Is air: %i", nodeManager.getNodeAt(x, y + 1, z) == 0, nodeManager.isAir(x, y + 1, z)); } }