[EngineConfig] Chunks are back to their old 16x16x32 state until superchunks are implemented.

This commit is contained in:
Quentin Bazin 2020-07-05 22:26:41 +02:00
parent 531b7badab
commit 084a002a6d
3 changed files with 6 additions and 6 deletions

View File

@ -177,7 +177,7 @@ void GameState::update() {
// Update far plane using render distance
static u16 oldRenderDistance = Config::renderDistance;
if (Config::renderDistance != oldRenderDistance) {
m_camera.setFarClippingPlane(Config::renderDistance * CHUNK_SIZE);
m_camera.setFarClippingPlane(Config::renderDistance * CHUNK_MAXSIZE);
oldRenderDistance = Config::renderDistance;
}
}

View File

@ -289,7 +289,7 @@ void ClientWorld::draw(gk::RenderTarget &target, gk::RenderStates states) const
// Our screen coordinates are +X right, +Y up, and for a right-handed
// coordinate system, depth must be negative Z, so anything with a
// positive Z is behind the camera.
if (center.z > CHUNK_SIZE / 2) {
if (center.z > CHUNK_MAXSIZE / 2) {
continue;
}

View File

@ -42,11 +42,11 @@ namespace {
constexpr float DIST_2D_FAR = 512.0f;
// Chunk size must be a power of two and fit in a signed byte
constexpr int CHUNK_SIZE = 16;
constexpr int CHUNK_WIDTH = 16;
constexpr int CHUNK_DEPTH = 16;
constexpr int CHUNK_HEIGHT = 32;
constexpr int CHUNK_WIDTH = CHUNK_SIZE;
constexpr int CHUNK_DEPTH = CHUNK_SIZE;
constexpr int CHUNK_HEIGHT = CHUNK_SIZE;
constexpr int CHUNK_MAXSIZE = CHUNK_WIDTH > CHUNK_DEPTH ? (CHUNK_HEIGHT > CHUNK_WIDTH ? CHUNK_HEIGHT : CHUNK_WIDTH) : (CHUNK_HEIGHT > CHUNK_DEPTH ? CHUNK_HEIGHT : CHUNK_DEPTH);
// Several parts of the code use & (CHUNK_xxx - 1) assuming they are powers of 2
static_assert((CHUNK_WIDTH & (CHUNK_WIDTH - 1)) == 0, "CHUNK_WIDTH is not a power of 2");