feat(rendering): distance fog and config-derived far plane

This commit is contained in:
MDietermann
2026-06-01 18:46:02 +02:00
parent 89ac70f1ab
commit 9daa9f8267
7 changed files with 42 additions and 4 deletions

View File

@@ -43,7 +43,7 @@ public sealed class Game : GameWindow
Log.Information("Game starting with seed={Seed} renderDistanceH={H} renderDistanceV={V}",
this._cfg.Seed, this._cfg.RenderDistanceHorizontal, this._cfg.RenderDistanceVertical);
GL.ClearColor(0.45f, 0.65f, 0.95f, 1.0f);
GL.ClearColor(this._cfg.SkyColor.X, this._cfg.SkyColor.Y, this._cfg.SkyColor.Z, 1.0f);
GL.Enable(EnableCap.DepthTest);
GL.Enable(EnableCap.CullFace);
@@ -119,6 +119,11 @@ public sealed class Game : GameWindow
this._shader.SetFloat("u_caveDarkStartY", this._cfg.CaveDarkStartY);
this._shader.SetFloat("u_caveDarkEndY", this._cfg.CaveDarkEndY);
this._shader.SetFloat("u_caveMinBrightness", this._cfg.CaveMinBrightness);
float fogEnd = this._cfg.RenderDistanceHorizontal * Chunk.Size;
this._shader.SetFloat("u_fogEnd", fogEnd);
this._shader.SetFloat("u_fogStart", fogEnd * this._cfg.FogStartFraction);
this._shader.SetVector3("u_cameraPos", this._player.Camera.Position);
this._shader.SetVector3("u_skyColor", this._cfg.SkyColor);
this._texture.Use(TextureUnit.Texture0);
this._streamer.DrawAll((pos, renderer) =>