Culling, rendering improvements and optimizations, block removing test.

This commit is contained in:
2025-09-02 22:43:35 +02:00
parent a9cab195b6
commit 00713db79e
16 changed files with 390 additions and 210 deletions

View File

@@ -4,11 +4,11 @@ namespace Voxel
{
static class Camera
{
public static Vector3 Position;
public static Vector3 Position = new Vector3(-8, 16, -8);
public static float Pitch = 0f;
public static float Yaw = -90f;
public static float FOV = 70f;
public static float Pitch = -22.5f;
public static float Yaw = 45f;
public static float FOV = 60f;
public static float Speed = 5f;
public static float ShiftSpeed = 20f;
@@ -56,18 +56,21 @@ namespace Voxel
public static void UpdateMouse(Vector2 delta)
{
float fov = MathHelper.DegreesToRadians(60f);
float aspectRatio = 800f / 600f;
float near = 0.1f;
float far = 100f;
projection = Matrix4.CreatePerspectiveFieldOfView(fov, aspectRatio, near, far);
float sensitivity = 0.1f;
Yaw += delta.X * sensitivity;
Pitch -= delta.Y * sensitivity;
Pitch = MathHelper.Clamp(Pitch, -89f, 89f);
}
public static void UpdateProjection(int width, int height)
{
float fov = MathHelper.DegreesToRadians(FOV);
float aspectRatio = width / (float)height;
float near = 0.1f;
float far = 1000f;
projection = Matrix4.CreatePerspectiveFieldOfView(fov, aspectRatio, near, far);
}
}
}