feat: wire infinite chunk streaming into Game with loading screen
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System.Collections;
|
||||
using OpenTK.Mathematics;
|
||||
using VoxelEngine.Core;
|
||||
using VoxelEngine.World.Blocks;
|
||||
@@ -7,7 +6,7 @@ using VoxelEngine.World.Persistence;
|
||||
namespace VoxelEngine.World;
|
||||
|
||||
public sealed class World(BlockRegistry registry, IChunkModificationStore modStore)
|
||||
: IWorld, IEnumerable<KeyValuePair<Vector3i, Chunk.Chunk>>
|
||||
: IWorld
|
||||
{
|
||||
private readonly Dictionary<Vector3i, Chunk.Chunk> _chunks = new();
|
||||
|
||||
@@ -60,7 +59,4 @@ public sealed class World(BlockRegistry registry, IChunkModificationStore modSto
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerator<KeyValuePair<Vector3i, Chunk.Chunk>> GetEnumerator() => this._chunks.GetEnumerator();
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => this.GetEnumerator();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ public sealed class WorldGenerator
|
||||
this._terrain = new TerrainSampler(noise, this._biomeMap);
|
||||
}
|
||||
|
||||
public int SurfaceHeightAt(int worldX, int worldZ) => this._terrain.HeightAt(worldX, worldZ);
|
||||
|
||||
public VoxelChunk Generate(Vector3i chunkPos)
|
||||
{
|
||||
VoxelChunk chunk = new();
|
||||
|
||||
Reference in New Issue
Block a user