small refactor

This commit is contained in:
2025-05-31 12:29:51 +02:00
parent aecb071472
commit 48decb4204
4 changed files with 88 additions and 94 deletions

View File

@@ -9,11 +9,18 @@
class NoiseCollection
{
public:
NoiseCollection(const std::uint32_t seed);
~NoiseCollection(void) = default;
void AddNoise(const std::string& key, std::unique_ptr<Noise> noise);
Noise* GetNoise(const std::string key) const;
[[nodiscard]] std::array<std::uint32_t, CHUNK_SIZE.y> GetBlocks(Scop::Vec2i pos);
inline NoiseCollection(const std::uint32_t seed)
{
m_collection.emplace("terrain", std::make_unique<Noise>(seed));
m_collection.emplace("caves", std::make_unique<Noise>(seed)); // TODO !!!!!!
}
Noise* GetNoise(const std::string& key) const;
inline void AddNoise(std::string key, std::unique_ptr<Noise> noise) { m_collection.emplace(std::move(key), std::move(noise)); }
[[nodiscard]] inline std::array<std::uint32_t, CHUNK_SIZE.y> GetBlocks(Scop::Vec2i pos) const { return m_collection.at("terrain")->GetHeight(pos); }
~NoiseCollection() = default;
private:
std::unordered_map<std::string, std::unique_ptr<Noise>> m_collection;