feat: add biome parameter adjustment

This commit is contained in:
2026-04-25 22:23:24 +08:00
parent a95ad796ce
commit 9402847e89
7 changed files with 227 additions and 25 deletions

View File

@@ -36,6 +36,7 @@ private:
TextEditing m_text_editing;
bool m_need_save_config = false;
int m_theme = 0;
void show_biome_table_bar();
void show_settings_tab_item();
void show_world_tab_item();
void show_player_tab_item();

View File

@@ -31,10 +31,40 @@ struct BiomeNonAdjacent {
Biome replace;
};
struct BaseBiomeParams {
Biome biome;
std::pair<float, float> temp;
std::pair<float, float> humid;
std::array<float, 3> frequencies;
BiomeHeightRange height_range;
};
struct PlainParams : public BaseBiomeParams {
};
struct ForestParams : public BaseBiomeParams {
float tree_frequency;
};
struct DesertParams : public BaseBiomeParams {
};
struct MountainParams : public BaseBiomeParams {
};
std::string get_biome_str(Biome biome);
Biome get_biome_from_noise(float temp, float humid);
std::array<float, 3> get_noise_frequencies_for_biome(Biome biome);
BiomeHeightRange get_biome_height_range(Biome biome);
Biome safe_int_to_biome(int x);
int get_interpolated_height(float world_x, float world_z, float temp, float humid);
PlainParams& plain_params();
ForestParams& forest_params();
DesertParams& desert_params();
MountainParams& mountain_params();
}

View File

@@ -47,6 +47,7 @@ private:
std::atomic<bool> m_is_rebuilding {false};
std::atomic<bool> m_could_gen{true};
std::atomic<int> m_rendering_distance{24};
std::atomic<float> m_chunk_gen_fraction{0.0f};
std::vector<ChunkPos> m_dirty_queue;
std::vector<ChunkRenderSnapshot> m_render_snapshots;
std::vector<std::pair<ChunkPos, Chunk>> m_new_chunk;
@@ -95,6 +96,9 @@ public:
void rebuild_world();
float chunk_gen_fraction() const;
int rendering_distance() const;
void rendering_distance(int rendering_distance);
};
}