Refactor to use NoiseCollection instead of Noise

This commit is contained in:
Namonay
2025-05-31 19:24:57 +02:00
parent 7c5ae10e79
commit 6ebd51b76e
6 changed files with 25 additions and 9 deletions

View File

@@ -11,15 +11,23 @@ class NoiseCollection
public:
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 !!!!!!
m_collection.emplace("terrain", std::make_unique<Noise>(seed, // seed
0.045f,
0.8f,
4,
2.0f,
0.7f,
4,
1.2f
));
//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); }
const std::array<std::uint32_t, CHUNK_SIZE.y> GetBlocks(Scop::Vec2i pos);
~NoiseCollection() = default;
private: