Turns out it was the semicolons at the end of the lines the if statements were in. This took make me way longer to realize than it should've. :/
This commit is contained in:
parent
3aa203bac9
commit
a0bec8bfc5
@ -1,5 +1,5 @@
|
|||||||
# depslib dependency file v1.0
|
# depslib dependency file v1.0
|
||||||
1667158149 source:c:\development\xtreemminer\main.cpp
|
1667160902 source:c:\development\xtreemminer\main.cpp
|
||||||
<stdlib.h>
|
<stdlib.h>
|
||||||
<GL/glut.h>
|
<GL/glut.h>
|
||||||
"Utilities.h"
|
"Utilities.h"
|
||||||
@ -12,12 +12,12 @@
|
|||||||
"FastNoiseLite.h"
|
"FastNoiseLite.h"
|
||||||
<random>
|
<random>
|
||||||
|
|
||||||
1667158420 c:\development\xtreemminer\include\noderenderer.h
|
1667163770 c:\development\xtreemminer\include\noderenderer.h
|
||||||
"Base.h"
|
"Base.h"
|
||||||
"MapBlock.h"
|
"MapBlock.h"
|
||||||
<GL/glut.h>
|
<GL/glut.h>
|
||||||
|
|
||||||
1667156676 c:\development\xtreemminer\include\mapblock.h
|
1667161818 c:\development\xtreemminer\include\mapblock.h
|
||||||
"Base.h"
|
"Base.h"
|
||||||
<math.h>
|
<math.h>
|
||||||
<cstdio>
|
<cstdio>
|
||||||
|
@ -63,18 +63,18 @@ class BlockManager
|
|||||||
{
|
{
|
||||||
//if(x < 16 && x >= 0 && z < 16 && z >= 0)
|
//if(x < 16 && x >= 0 && z < 16 && z >= 0)
|
||||||
//{
|
//{
|
||||||
if(x < 0 || z < 0)
|
if(x < 0 || y < 0 || z < 0)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Position2D block = BlockUtilities::getBlockFromNodeCoordinates(x, z);
|
Position2D block = BlockUtilities::getBlockFromNodeCoordinates(x, z);
|
||||||
//printf("\n\nold x: %i, old z: %i", x, z);
|
//printf("\n\nold x: %i, old z: %i", x, z);
|
||||||
//int localX = x - block.x * 16;
|
int localX = x - block.x * 16;
|
||||||
//int localZ = z - block.z * 16;
|
int localZ = z - block.z * 16;
|
||||||
//printf("\nnew x: %i, new z: %i", x, z);
|
//printf("\nnew x: %i, new z: %i", x, z);
|
||||||
//return mapBlocks[block.x][block.z].mapBlock[256 * y + localZ * 16 + localX];
|
return mapBlocks[block.x][block.z].mapBlock[256 * y + localZ * 16 + localX];
|
||||||
return mapBlocks[block.x][block.z].getNodeAt(x, y, z);
|
//return mapBlocks[block.x][block.z].getNodeAt(x - block.x * 16, y, z - block.z * 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isAir(int x, int y, int z)
|
bool isAir(int x, int y, int z)
|
||||||
|
@ -25,7 +25,7 @@ class NodeRenderer
|
|||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
// Front
|
// Front
|
||||||
if(blockManager.mapBlocks[block.x][block.z].getNodeAt(x - block.x * 16, y, z - block.z * 16 - 1) == 0)
|
if(blockManager.isAir(x, y, z + 1))
|
||||||
{
|
{
|
||||||
glTexCoord2f(.0F, .0F);
|
glTexCoord2f(.0F, .0F);
|
||||||
glVertex3f(x + .0F, y + 1.0F, z + .0F);
|
glVertex3f(x + .0F, y + 1.0F, z + .0F);
|
||||||
@ -43,7 +43,7 @@ class NodeRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Back
|
// Back
|
||||||
if(blockManager.mapBlocks[block.x][block.z].getNodeAt(x - block.x * 16, y, z - block.z * 16 + 1) == 0)
|
if(blockManager.isAir(x, y, z - 1))
|
||||||
{
|
{
|
||||||
|
|
||||||
glTexCoord2f(.0F, .0F);
|
glTexCoord2f(.0F, .0F);
|
||||||
@ -62,7 +62,7 @@ class NodeRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Right
|
// Right
|
||||||
if(blockManager.mapBlocks[block.x][block.z].getNodeAt(x - block.x * 16 + 1, y, z - block.z * 16) == 0);
|
if(blockManager.isAir(x + 1, y, z))
|
||||||
{
|
{
|
||||||
glTexCoord2f(1.0F, .0F);
|
glTexCoord2f(1.0F, .0F);
|
||||||
glVertex3f(x + 1.0F, y + 1.0F, z + .0F);
|
glVertex3f(x + 1.0F, y + 1.0F, z + .0F);
|
||||||
@ -80,7 +80,7 @@ class NodeRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Left
|
// Left
|
||||||
if(blockManager.mapBlocks[block.x][block.z].getNodeAt(x - block.x * 16 - 1, y, z - block.z * 16) == 0);
|
if(blockManager.isAir(x - 1, y, z))
|
||||||
{
|
{
|
||||||
glTexCoord2f(1.0F, .0F);
|
glTexCoord2f(1.0F, .0F);
|
||||||
glVertex3f(x + .0F, y + 1.0F, z + .0F);
|
glVertex3f(x + .0F, y + 1.0F, z + .0F);
|
||||||
@ -98,8 +98,10 @@ class NodeRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bottom
|
// Bottom
|
||||||
if(blockManager.getNodeAt(x, y - 1, z) == 0);
|
//printf("\n\nx: %i, y: %i, z: %i, VALUE: %s", x, y, z, blockManager.isAir(x, y - 1, z) ? "true" : "false");
|
||||||
|
if(blockManager.isAir(x, y - 1, z))
|
||||||
{
|
{
|
||||||
|
//printf("\nWUT? x: %i, y: %i, z: %i, VALUE: %s", x, y, z, blockManager.isAir(x, y - 1, z) ? "true" : "false");
|
||||||
glTexCoord2f(.0F, .0F);
|
glTexCoord2f(.0F, .0F);
|
||||||
glVertex3f(x + 1.0F, y + .0F, z + .0F);
|
glVertex3f(x + 1.0F, y + .0F, z + .0F);
|
||||||
|
|
||||||
@ -114,7 +116,7 @@ class NodeRenderer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Top
|
// Top
|
||||||
/*if(blockManager.mapBlocks[block.x][block.z].getNodeAt(x - block.x * 16, y + 1, z - block.z * 16) == 0);
|
if(blockManager.isAir(x, y + 1, z))
|
||||||
{
|
{
|
||||||
glTexCoord2f(.0F, .0F);
|
glTexCoord2f(.0F, .0F);
|
||||||
glVertex3f(x + 1.0F, y + 1.0F, z + .0F);
|
glVertex3f(x + 1.0F, y + 1.0F, z + .0F);
|
||||||
@ -127,7 +129,7 @@ class NodeRenderer
|
|||||||
|
|
||||||
glTexCoord2f(.0F, 1.0F);
|
glTexCoord2f(.0F, 1.0F);
|
||||||
glVertex3f(x + 1.0F, y + 1.0F, z + 1.0F);
|
glVertex3f(x + 1.0F, y + 1.0F, z + 1.0F);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
return 1;
|
return 1;
|
||||||
|
6
main.cpp
6
main.cpp
@ -197,9 +197,9 @@ int main(int argc, char **argv)
|
|||||||
cellular.SetNoiseType(FastNoiseLite::NoiseType_Cellular);
|
cellular.SetNoiseType(FastNoiseLite::NoiseType_Cellular);
|
||||||
cellular.SetFrequency(.1F);
|
cellular.SetFrequency(.1F);
|
||||||
|
|
||||||
for(int bx = 0; bx < 16; bx++)
|
for(int bx = 0; bx < 1; bx++)
|
||||||
{
|
{
|
||||||
for(int bz = 0; bz < 16; bz++)
|
for(int bz = 0; bz < 1; bz++)
|
||||||
{
|
{
|
||||||
for(int x = 0; x < 16; x++)
|
for(int x = 0; x < 16; x++)
|
||||||
{
|
{
|
||||||
@ -216,7 +216,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("\n0, 2, 0: %i", blockManager.isAir(0, 1, 0));
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user