no sky caves

save some calculation, don't cut air in air
This commit is contained in:
Ethan 2024-10-19 02:53:59 +01:00
parent 546a3283c4
commit cfeda4efc9

View File

@ -308,10 +308,17 @@ void WorldGen::GenerateChunkData(int chunkX, int chunkY, int chunkZ, int chunkSi
for (int y = 0; y < chunkSize; y++) for (int y = 0; y < chunkSize; y++)
{ {
// Cave noise
bool cave = false;
int currentY = y + startY; int currentY = y + startY;
if (currentY > noiseY and currentY > waterLevel)
{
// Sky is air, no need to process
chunkData->push_back(Blocks::AIR);
continue;
}
// Cave noise
bool cave = false;
for (int i = 0; i < caveSettingsLength; i++) for (int i = 0; i < caveSettingsLength; i++)
{ {
if (currentY > caveSettings[i].maxHeight) if (currentY > caveSettings[i].maxHeight)
@ -331,21 +338,18 @@ void WorldGen::GenerateChunkData(int chunkX, int chunkY, int chunkZ, int chunkSi
} }
// Step 1: Terrain Shape (surface and caves) and Ores // Step 1: Terrain Shape (surface and caves) and Ores
if (cave) {
// Sky and Caves // TODO: This is where cave stuff goes
if (currentY > noiseY)
{
if (currentY <= waterLevel)
chunkData->push_back(Blocks::WATER);
else
chunkData->push_back(Blocks::AIR);
continue;
}
else if (cave) {
chunkData->push_back(Blocks::AIR); chunkData->push_back(Blocks::AIR);
continue; continue;
} }
if (currentY > noiseY and currentY <= waterLevel)
// TODO: This is where wet stuff goes
chunkData->push_back(Blocks::WATER);
continue
}
// Ground // Ground
bool blockSet = false; bool blockSet = false;
for (int i = 0; i < oreSettingsLength; i++) for (int i = 0; i < oreSettingsLength; i++)