#pragma once #include #include #include namespace Cubed { constexpr float BIOME_NOISE_FREQUENCY = 0.03f; constexpr float PLAIN_FREQ = 0.4f; constexpr float FOREST_FREQ = 1.2f; constexpr float DESERT_FREQ = 1.2f; constexpr float MOUNTAIN_FREQ = 2.0f; enum class Biome { PLAIN = 0, FOREST, DESERT, MOUNTAIN, RIVER, NONE }; struct BiomeHeightRange { int base_y; int amplitude; }; struct BiomeNonAdjacent { Biome first; std::vector second; Biome replace; }; static inline const std::vector NON_ADJACENT{ {{Biome::PLAIN, {Biome::DESERT}, Biome::RIVER}, {Biome::FOREST, {Biome::DESERT}, Biome::RIVER}, {Biome::DESERT, {Biome::MOUNTAIN, Biome::FOREST}, Biome::RIVER}, {Biome::MOUNTAIN, {Biome::DESERT, Biome::FOREST}, Biome::RIVER}}}; struct BaseBiomeParams { Biome biome; std::pair temp; std::pair humid; std::array frequencies; BiomeHeightRange height_range; }; struct PlainParams : public BaseBiomeParams {}; struct ForestParams : public BaseBiomeParams { float tree_frequency; }; struct DesertParams : public BaseBiomeParams {}; struct MountainParams : public BaseBiomeParams {}; struct RiverParams : public BaseBiomeParams {}; std::string get_biome_str(Biome biome); Biome get_biome_from_noise(float temp, float humid); std::array 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(); RiverParams& river_params(); } // namespace Cubed