[ChunkBuilder] Tried to add per-face lighting.

This commit is contained in:
Quentin Bazin 2018-06-25 01:42:44 +02:00
parent dcb5d3b6b0
commit f0b7b1efd5
2 changed files with 9 additions and 3 deletions

View File

@ -141,7 +141,13 @@ void ChunkBuilder::addFace(u8 x, u8 y, u8 z, u8 i, const Chunk &chunk, const Blo
vertex.texCoord[0] = faceTexCoords[j * 2];
vertex.texCoord[1] = faceTexCoords[j * 2 + 1];
vertex.lightValue[0] = chunk.getSunlight(x, y, z);
int sunlight = chunk.getSunlight(x, y, z);
if ((i == 0 || i == 1 || i == 4 || i == 5) && sunlight > 2)
vertex.lightValue[0] = sunlight - 2;
if (i == 4 && sunlight > 3)
vertex.lightValue[0] = sunlight - 3;
else
vertex.lightValue[0] = sunlight;
vertex.lightValue[1] = chunk.getTorchlight(x, y, z);
m_vertices.emplace_back(vertex);

View File

@ -81,14 +81,14 @@ void TerrainGenerator::testCraftGeneration(Chunk &chunk) const {
chunk.setBlock(x + ix, y + h + iy, z + iz, 4);
if (iy == 2)
chunk.addSunlight(chunk, x + ix, y + h + iy, z + iz, 8);
chunk.addSunlight(chunk, x + ix, y + h + iy, z + iz, 15);
}
}
}
}
}
else {
chunk.addSunlight(chunk, x, y, z, 8);
chunk.addSunlight(chunk, x, y, z, 15);
}
break;
}