mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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.
This commit is contained in:
parent
fa6b21a15b
commit
76f4856479
16 changed files with 421 additions and 304 deletions
21
src/mapgen.h
21
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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue