summaryrefslogtreecommitdiff
path: root/src/mapgen.h
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2016-04-28 03:43:09 -0400
committerkwolekr <kwolekr@minetest.net>2016-05-27 23:23:58 -0400
commit76f485647983ebd7eb4c3abbca0869d13f76920b (patch)
tree6e6f4745311f2ac834780b5bf142dfeeea3aceb0 /src/mapgen.h
parentfa6b21a15b415cd82dce6896b94a5341b7dd76f0 (diff)
downloadminetest-76f485647983ebd7eb4c3abbca0869d13f76920b.tar.gz
minetest-76f485647983ebd7eb4c3abbca0869d13f76920b.tar.bz2
minetest-76f485647983ebd7eb4c3abbca0869d13f76920b.zip
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.
Diffstat (limited to 'src/mapgen.h')
-rw-r--r--src/mapgen.h21
1 files changed, 9 insertions, 12 deletions
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();