Files
VoxelEngine/Game/Player.cs
MDietermann e034d10339 feat(world-gen): larger biomes, smooth height blending, capped mountains; centralize tunables in Configuration
Terrain feel: biome regions ~10x larger (Voronoi cell size 96->960); terrain height now eases across biome borders via a Voronoi distance blend (smooth, and ~25x cheaper than the old 169-sample box blur); mountains capped to ~2/3 world height and gentled (ridged amplitude/frequency lowered), snow line lowered to match.

Centralization: ~27 world-gen/render tuning constants (biome amplitudes & frequencies, climate-noise frequencies/octaves, biome-selection thresholds, blend width, cell size, filler depth, snow line, camera near plane, spawn offset, overlay scale) hoisted from scattered literals into a region-organized, fully-commented Configuration. Configuration is threaded into NoiseSource, the biomes, BiomeRegistry, BiomeMap (+Classify), TerrainSampler, WorldGenerator (+BlockAt filler depth), and Camera via Player. Defaults equal the prior values, so generation is unchanged; worldgen tests updated for the new constructor signatures.
2026-06-03 16:27:06 +02:00

44 lines
1.3 KiB
C#

using OpenTK.Mathematics;
using VoxelEngine.Core;
using VoxelEngine.Rendering;
using VoxelChunk = VoxelEngine.World.Chunk.Chunk;
namespace VoxelEngine.Game;
public sealed class Player
{
private readonly Configuration _cfg;
public Camera Camera { get; }
public Vector3 Position => this.Camera.Position;
public float MoveSpeed => this._cfg.MoveSpeed;
public float MouseSensitivity => this._cfg.MouseSensitivity;
public Vector3i ChunkPosition
{
get
{
Vector3 p = this.Position;
return new Vector3i(
ChunkMath.FloorDiv((int)MathF.Floor(p.X), VoxelChunk.Size),
ChunkMath.FloorDiv((int)MathF.Floor(p.Y), VoxelChunk.Size),
ChunkMath.FloorDiv((int)MathF.Floor(p.Z), VoxelChunk.Size));
}
}
public Player(Configuration cfg, Vector3 spawnPosition, float aspectRatio)
{
this._cfg = cfg;
this.Camera = new Camera(spawnPosition, aspectRatio)
{
Fov = cfg.Fov,
NearPlane = cfg.CameraNearPlane,
FarPlane = (cfg.RenderDistanceHorizontal + 1) * VoxelChunk.Size,
};
}
public void Move(Vector3 delta) => this.Camera.Move(delta);
public void AddRotation(float yawDelta, float pitchDelta) => this.Camera.AddRotation(yawDelta, pitchDelta);
}