mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-18 00:27:02 +08:00
feat: improve mountain realism
This commit is contained in:
@@ -7,8 +7,15 @@ namespace Cubed {
|
||||
|
||||
constexpr float BIOME_NOISE_FREQUENCY = 0.03f;
|
||||
constexpr float HEIGHTMAP_NOISE_FREQUENCY = 0.001f;
|
||||
constexpr float MOUNTAINOUS_NOISE_FREQUENCY = 0.003f;
|
||||
enum class BiomeType { PLAIN = 0, FOREST, DESERT, MOUNTAIN, RIVER, NONE };
|
||||
|
||||
struct BiomeConditions {
|
||||
float temp = 0.0f;
|
||||
float humid = 0.0f;
|
||||
float mountainous = 0.0f;
|
||||
};
|
||||
|
||||
struct BiomeHeightRange {
|
||||
int base_y;
|
||||
int amplitude;
|
||||
@@ -47,13 +54,14 @@ struct MountainParams : public BaseBiomeParams {};
|
||||
struct RiverParams : public BaseBiomeParams {};
|
||||
|
||||
std::string get_biome_str(BiomeType biome);
|
||||
BiomeType get_biome_from_noise(float temp, float humid);
|
||||
std::array<float, 3> get_noise_frequencies_for_biome(BiomeType biome);
|
||||
BiomeHeightRange get_biome_height_range(BiomeType biome);
|
||||
BiomeType safe_int_to_biome(int x);
|
||||
int get_interpolated_height(float world_x, float world_z, float temp,
|
||||
float humid);
|
||||
|
||||
BiomeType determine_biome(const BiomeConditions& conditions);
|
||||
|
||||
PlainParams& plain_params();
|
||||
ForestParams& forest_params();
|
||||
DesertParams& desert_params();
|
||||
|
||||
@@ -38,6 +38,9 @@ private:
|
||||
float frequency = 0.01f;
|
||||
float height = 80;
|
||||
unsigned m_seed = 0;
|
||||
|
||||
BiomeConditions m_conditions;
|
||||
|
||||
void clear_dirty();
|
||||
|
||||
public:
|
||||
@@ -108,6 +111,7 @@ public:
|
||||
std::vector<BlockType>& blocks();
|
||||
World& world();
|
||||
unsigned seed() const;
|
||||
BiomeConditions& conditions();
|
||||
};
|
||||
|
||||
} // namespace Cubed
|
||||
Reference in New Issue
Block a user