Commit Graph

5 Commits

Author SHA1 Message Date
6186952313 Use fabsf() in _generate_chunk 2025-09-17 20:34:09 +01:00
5678b0f0c3 [Add] Fractal noise and random seed to world gen. 2025-09-17 19:45:02 +01:00
e35c4b5d61 [Fix] Visible lighting seems between chunks.
Server now generates and sends an expanded 34x34 heightmap for each
chunk, which includes a 1-vertex border containing height information
from all adjacent chunks.

Client ChunkMesh class updated to consume this extra data, allowing it
to calcualte perfectly accurate normal vectors for all vertices,
including those at the very edge of a chunk.
2025-09-17 19:19:38 +01:00
fa7159587d [Add] Terrain lighting.
* Chunks are now rendered as solid, lit meshes instead of wireframe.
* The GLSL shaders have been updated to a directional lighting model.
* Chunkmes now calculates normal vectors for each vertex to enable the
  lighting.
* Shader class now has a 'set_vec3' method for sending lighting date to
  the GPU.

Bug Fix:
* Resolves visual artifacts and "seams" at chunk boundaries.

Next up:
* To calculate the correct angle for a vertex at the edge of chunk A, we
  need to know the height of the terrain in the neighboiring Chunk B.
Since it doesn't have that information, the GPU's making an appoximate
guess. We need to generate and send a small "border" of height data
along with each chunk, I'll do this by increasing the size of the
heightmap array in the network message so it can hold the 32x32 chunk
plus 1 vertex border all around. MAking it 34x34 for each chunk.
2025-09-16 23:58:03 +01:00
7ba0b348bc [Add] Initial terrain generation. 2025-09-16 20:49:00 +01:00