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

@@ -10,6 +10,7 @@ public sealed class Camera
public float Yaw { get; private set; } = -90f; // degrees; -90 looks down -Z
public float Pitch { get; private set; } // degrees
public float Fov { get; set; } = 60f; // degrees
public float FarPlane { get; set; } = 100f; // world units
public float AspectRatio { get; set; }
public Vector3 Front { get; private set; } = -Vector3.UnitZ;
@@ -36,7 +37,7 @@ public sealed class Camera
public Matrix4 GetProjectionMatrix() =>
Matrix4.CreatePerspectiveFieldOfView(
MathHelper.DegreesToRadians(this.Fov), this.AspectRatio, 0.1f, 100f);
MathHelper.DegreesToRadians(this.Fov), this.AspectRatio, 0.1f, this.FarPlane);
private void UpdateVectors()
{

View File

@@ -39,6 +39,9 @@ public sealed class Shader : IDisposable
public void SetFloat(string name, float value) =>
GL.Uniform1(this.Location(name), value);
public void SetVector3(string name, Vector3 value) =>
GL.Uniform3(this.Location(name), value.X, value.Y, value.Z);
private int Location(string name)
{
if (this._uniforms.TryGetValue(name, out int location)) return location;