From 76f485647983ebd7eb4c3abbca0869d13f76920b Mon Sep 17 00:00:00 2001 From: kwolekr Date: Thu, 28 Apr 2016 03:43:09 -0400 Subject: Move biome calculation to BiomeGen BiomeGen defines an interface that, given a set of BiomeParams, computes biomes for a given area using the algorithm implemented by that specific BiomeGen. This abstracts away the old system where each mapgen supplied the noises required for biome generation. --- src/mapgen.h | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src/mapgen.h') diff --git a/src/mapgen.h b/src/mapgen.h index abc3d2e89..554ec6084 100644 --- a/src/mapgen.h +++ b/src/mapgen.h @@ -44,6 +44,8 @@ extern FlagDesc flagdesc_mapgen[]; extern FlagDesc flagdesc_gennotify[]; class Biome; +class BiomeGen; +struct BiomeParams; class EmergeManager; class MapBlock; class VoxelManipulator; @@ -115,11 +117,7 @@ struct MapgenParams { s16 water_level; u32 flags; - NoiseParams np_biome_heat; - NoiseParams np_biome_heat_blend; - NoiseParams np_biome_humidity; - NoiseParams np_biome_humidity_blend; - + BiomeParams *bparams; MapgenSpecificParams *sparams; MapgenParams() : @@ -128,12 +126,12 @@ struct MapgenParams { seed(0), water_level(1), flags(MG_CAVES | MG_LIGHT | MG_DECORATIONS), - np_biome_heat(NoiseParams(50, 50, v3f(750.0, 750.0, 750.0), 5349, 3, 0.5, 2.0)), - np_biome_heat_blend(NoiseParams(0, 1.5, v3f(8.0, 8.0, 8.0), 13, 2, 1.0, 2.0)), - np_biome_humidity(NoiseParams(50, 50, v3f(750.0, 750.0, 750.0), 842, 3, 0.5, 2.0)), - np_biome_humidity_blend(NoiseParams(0, 1.5, v3f(8.0, 8.0, 8.0), 90003, 2, 1.0, 2.0)), + bparams(NULL), sparams(NULL) - {} + { + } + + virtual ~MapgenParams(); void load(const Settings &settings); void save(Settings &settings) const; @@ -153,10 +151,9 @@ public: u32 blockseed; s16 *heightmap; u8 *biomemap; - float *heatmap; - float *humidmap; v3s16 csize; + BiomeGen *biomegen; GenerateNotifier gennotify; Mapgen(); -- cgit v1.2.3