mirror of
https://github.com/Kbz-8/42_vox.git
synced 2026-01-11 14:43:34 +00:00
Refactor logic from Noise to NoiseCollection
This commit is contained in:
@@ -6,6 +6,10 @@
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
constexpr std::uint32_t ARTIFICIAL_ELEVATION = 40;
|
||||
|
||||
constexpr std::uint32_t WATER_LEVEL = 20;
|
||||
|
||||
class NoiseCollection
|
||||
{
|
||||
public:
|
||||
@@ -20,13 +24,20 @@ class NoiseCollection
|
||||
4,
|
||||
1.2f
|
||||
));
|
||||
//m_collection.emplace("caves", std::make_unique<Noise>(seed)); // TODO !!!!!!
|
||||
m_collection.emplace("caves", std::make_unique<Noise>(seed,
|
||||
0.02f,
|
||||
1.0f,
|
||||
5,
|
||||
2.0f,
|
||||
0.5f,
|
||||
3,
|
||||
1.0f
|
||||
)); // 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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user