From 52732d71e72b02ff45e25f44e414f87ec9ab7666 Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 29 Jun 2023 22:15:32 +0200 Subject: Pretty terrain generation --- src/World/Chunk.hpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'src/World/Chunk.hpp') diff --git a/src/World/Chunk.hpp b/src/World/Chunk.hpp index 2b0379c..d200039 100644 --- a/src/World/Chunk.hpp +++ b/src/World/Chunk.hpp @@ -1,29 +1,36 @@ #pragma once #include -#include +#include "BiomeType.hpp" #include "BlockType.hpp" #include "../GFX/Mesh.hpp" #include "BlockSide.hpp" -#include "../GFX/Binder.hpp" namespace MC::World { class Chunk { public: - static constexpr const uint32_t Width = 16; - static constexpr const uint32_t Height = 128; + static constexpr uint32_t Width = 16; + static constexpr uint32_t Height = 128; Chunk(int64_t x, int64_t y) - : m_blocks{Chunk::Width * Chunk::Height * Chunk::Width, {BlockType::Air}}, - m_position{(float)x * Chunk::Width, 0.0f, (float)y * Chunk::Width} {}; + : m_blocks{Width * Height * Width, {BlockType::Air}}, + m_position{(float)x * Width, 0.0f, (float)y * Width} {} struct BlockData { BlockType type; }; - void set(uint32_t x, uint32_t y, uint32_t z, BlockData type); - BlockData get(uint32_t x, uint32_t y, uint32_t z); + void set(uint32_t x, uint32_t y, uint32_t z, BlockData data); + BlockData get(uint32_t x, uint32_t y, uint32_t z) const; + + struct Details { + Matrix landmass_values{}; + Matrix hill_values{}; + Matrix biome_values{}; + }; + void set_details(const Details& details) { m_details = details; } + Details& details(){ return m_details; } Vector<3> position(); GFX::Mesh mesh(); @@ -37,6 +44,8 @@ private: Vector<3> m_position; std::vector m_blocks; + + Details m_details; }; } -- cgit 1.4.1