feat: Random Seed toggle & removed unused atlas.png

This commit is contained in:
2026-06-01 09:24:52 +02:00
parent a8e94a27b2
commit c1be0f75e5
2 changed files with 8 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 910 KiB

View File

@@ -15,6 +15,7 @@ public sealed class Game : GameWindow
private const float MoveSpeed = 8f; // units per second private const float MoveSpeed = 8f; // units per second
private const float Sensitivity = 0.15f; // degrees per pixel private const float Sensitivity = 0.15f; // degrees per pixel
private const int Seed = 1337; private const int Seed = 1337;
private const bool UseSeed = false;
private readonly BlockRegistry _registry = new(); private readonly BlockRegistry _registry = new();
private Shader _shader = null!; private Shader _shader = null!;
@@ -40,10 +41,13 @@ public sealed class Game : GameWindow
this._texture = new Texture("Assets/textures/VoxelShadeAtlas.png"); this._texture = new Texture("Assets/textures/VoxelShadeAtlas.png");
this._world = new World.World(this._registry); this._world = new World.World(this._registry);
this._generator = new WorldGenerator(Game.Seed, this._registry);
for (int cx = -2; cx < 2; cx++) int seed = Game.UseSeed ? Game.Seed : new Random().Next();
for (int cz = -2; cz < 2; cz++)
this._generator = new WorldGenerator(seed, this._registry);
for (int cx = -4; cx < 4; cx++)
for (int cz = -4; cz < 4; cz++)
for (int cy = 0; cy < WorldConstants.WorldHeightChunks; cy++) for (int cy = 0; cy < WorldConstants.WorldHeightChunks; cy++)
{ {
Vector3i pos = new(cx, cy, cz); Vector3i pos = new(cx, cy, cz);
@@ -107,7 +111,7 @@ public sealed class Game : GameWindow
this._shader.SetMatrix4("view", this._camera.GetViewMatrix()); this._shader.SetMatrix4("view", this._camera.GetViewMatrix());
this._shader.SetMatrix4("projection", this._camera.GetProjectionMatrix()); this._shader.SetMatrix4("projection", this._camera.GetProjectionMatrix());
this._shader.SetInt("atlas", 0); this._shader.SetInt("atlas", 0);
this._texture.Use(TextureUnit.Texture0); this._texture.Use();
foreach ((Vector3i pos, ChunkRenderer renderer) in this._renderer) foreach ((Vector3i pos, ChunkRenderer renderer) in this._renderer)
{ {