mapgen: drop mapgen id from child mapgens.
[oweals/minetest.git] / src / mapgen / mg_biome.h
index f45238f28f6dd9d90933f8242467b06eb93b62e1..1f60f7baca431919591ff1df96743d03f3cd5f1c 100644 (file)
@@ -1,7 +1,7 @@
 /*
 Minetest
-Copyright (C) 2014-2016 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
-Copyright (C) 2014-2017 paramat
+Copyright (C) 2014-2018 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
+Copyright (C) 2014-2018 paramat
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
@@ -36,13 +36,8 @@ typedef u8 biome_t;
 
 #define BIOME_NONE ((biome_t)0)
 
-// TODO(hmmmm): Decide whether this is obsolete or will be used in the future
 enum BiomeType {
        BIOMETYPE_NORMAL,
-       BIOMETYPE_LIQUID,
-       BIOMETYPE_NETHER,
-       BIOMETYPE_AETHER,
-       BIOMETYPE_FLAT,
 };
 
 class Biome : public ObjDef, public NodeResolver {
@@ -57,16 +52,21 @@ public:
        content_t c_river_water;
        content_t c_riverbed;
        content_t c_dust;
+       content_t c_cave_liquid;
+       content_t c_dungeon;
+       content_t c_dungeon_alt;
+       content_t c_dungeon_stair;
 
        s16 depth_top;
        s16 depth_filler;
        s16 depth_water_top;
        s16 depth_riverbed;
 
-       s16 y_min;
-       s16 y_max;
+       v3s16 min_pos;
+       v3s16 max_pos;
        float heat_point;
        float humidity_point;
+       s16 vertical_blend;
 
        virtual void resolveNodeNames();
 };
@@ -107,14 +107,14 @@ public:
        // Gets all biomes in current chunk using each corresponding element of
        // heightmap as the y position, then stores the results by biome index in
        // biomemap (also returned)
-       virtual biome_t *getBiomes(s16 *heightmap) = 0;
+       virtual biome_t *getBiomes(s16 *heightmap, v3s16 pmin) = 0;
 
        // Gets a single biome at the specified position, which must be contained
        // in the region formed by m_pmin and (m_pmin + m_csize - 1).
        virtual Biome *getBiomeAtPoint(v3s16 pos) const = 0;
 
        // Same as above, but uses a raw numeric index correlating to the (x,z) position.
-       virtual Biome *getBiomeAtIndex(size_t index, s16 y) const = 0;
+       virtual Biome *getBiomeAtIndex(size_t index, v3s16 pos) const = 0;
 
        // Result of calcBiomes bulk computation.
        biome_t *biomemap = nullptr;
@@ -163,11 +163,11 @@ public:
        Biome *calcBiomeAtPoint(v3s16 pos) const;
        void calcBiomeNoise(v3s16 pmin);
 
-       biome_t *getBiomes(s16 *heightmap);
+       biome_t *getBiomes(s16 *heightmap, v3s16 pmin);
        Biome *getBiomeAtPoint(v3s16 pos) const;
-       Biome *getBiomeAtIndex(size_t index, s16 y) const;
+       Biome *getBiomeAtIndex(size_t index, v3s16 pos) const;
 
-       Biome *calcBiomeFromNoise(float heat, float humidity, s16 y) const;
+       Biome *calcBiomeFromNoise(float heat, float humidity, v3s16 pos) const;
 
        float *heatmap;
        float *humidmap;
@@ -224,6 +224,13 @@ public:
 
        virtual void clear();
 
+       // For BiomeGen type 'BiomeGenOriginal'
+       float getHeatAtPosOriginal(v3s16 pos, NoiseParams &np_heat,
+               NoiseParams &np_heat_blend, u64 seed);
+       float getHumidityAtPosOriginal(v3s16 pos, NoiseParams &np_humidity,
+               NoiseParams &np_humidity_blend, u64 seed);
+       Biome *getBiomeFromNoiseOriginal(float heat, float humidity, v3s16 pos);
+
 private:
        Server *m_server;