diff --git a/resources/shaders/game.f.glsl b/resources/shaders/game.f.glsl index 9859790b..be92a445 100644 --- a/resources/shaders/game.f.glsl +++ b/resources/shaders/game.f.glsl @@ -10,7 +10,6 @@ varying float v_blockFace; varying float v_dist; uniform int u_renderDistance; - uniform sampler2D u_tex; // Get light color @@ -25,9 +24,6 @@ void main() { float blockFace = floor(v_blockFace + 0.5); float lightCheck = floor(v_lightValue.x + 0.5); - // Discard if the pixel is too far away - if(blockFace > -1. && v_dist > u_renderDistance) discard; - // Get current pixel color and apply multiplier on grayscale textures vec4 color = v_color; if (v_texCoord.x > -0.99 && v_texCoord.y > -0.99) { diff --git a/resources/shaders/game.v.glsl b/resources/shaders/game.v.glsl index ab92b7f1..5f3fe4cc 100644 --- a/resources/shaders/game.v.glsl +++ b/resources/shaders/game.v.glsl @@ -21,7 +21,6 @@ uniform mat4 u_modelMatrix; uniform mat4 u_projectionMatrix; uniform mat4 u_viewMatrix; -uniform int u_renderDistance; // uniform int u_time; void main() { diff --git a/source/client/states/GameState.cpp b/source/client/states/GameState.cpp index 8837b3ee..5827ec4e 100644 --- a/source/client/states/GameState.cpp +++ b/source/client/states/GameState.cpp @@ -173,6 +173,13 @@ void GameState::update() { } m_client.update(); + + // Update far plane using render distance + static u16 oldRenderDistance = Config::renderDistance; + if (Config::renderDistance != oldRenderDistance) { + m_camera.setFarClippingPlane(Config::renderDistance * CHUNK_SIZE); + oldRenderDistance = Config::renderDistance; + } } void GameState::initShaders() {