feat: add cave (#8)

* feat: add cave generate

* fix: incorrect blocks on cave surface

* fix: non-deterministic cave generator

* refactor: move all chunk generation to dedicated generation thread

* refactor: remove inital cave

* feat: add cave parameter adjustment

* refactor: adjust cave probability
This commit is contained in:
zhenyan121
2026-05-09 20:13:55 +08:00
committed by GitHub
parent d986e03f9c
commit 1a26474a05
19 changed files with 456 additions and 33 deletions

View File

@@ -1,11 +1,9 @@
#include "Cubed/tools/cubed_random.hpp"
#include "Cubed/tools/log.hpp"
namespace Cubed {
Random::Random() {}
Random::Random(unsigned seed) { init(seed); }
bool Random::random_bool(double probability) {
std::bernoulli_distribution dist(probability);
return dist(m_engine);
@@ -19,5 +17,13 @@ void Random::init(unsigned seed) {
m_seed = seed;
m_engine.seed(seed);
}
int Random::random_int(int min, int max) {
std::uniform_int_distribution<int> dist(min, max);
return dist(m_engine);
}
float Random::random_float(float min, float max) {
std::uniform_real_distribution<float> dist(min, max);
return dist(m_engine);
}
} // namespace Cubed