#include <mapgen.h>
Public Member Functions | |
Mapgen ()=default | |
Mapgen (int mapgenid, MapgenParams *params, EmergeParams *emerge) | |
virtual | ~Mapgen () |
DISABLE_CLASS_COPY (Mapgen) | |
virtual MapgenType | getType () const |
s16 | findGroundLevel (v2s16 p2d, s16 ymin, s16 ymax) |
s16 | findLiquidSurface (v2s16 p2d, s16 ymin, s16 ymax) |
void | updateHeightmap (v3s16 nmin, v3s16 nmax) |
void | getSurfaces (v2s16 p2d, s16 ymin, s16 ymax, std::vector< s16 > &floors, std::vector< s16 > &ceilings) |
void | updateLiquid (UniqueQueue< v3s16 > *trans_liquid, v3s16 nmin, v3s16 nmax) |
void | setLighting (u8 light, v3s16 nmin, v3s16 nmax) |
Set light in entire area to fixed value. | |
void | calcLighting (v3s16 nmin, v3s16 nmax, v3s16 full_nmin, v3s16 full_nmax, bool propagate_shadow=true) |
Run all lighting calculations. | |
void | propagateSunlight (v3s16 nmin, v3s16 nmax, bool propagate_shadow) |
Spread sunlight from the area above downwards. | |
void | spreadLight (const v3s16 &nmin, const v3s16 &nmax) |
Spread light in the given area. | |
virtual void | makeChunk (BlockMakeData *data) |
virtual int | getGroundLevelAtPoint (v2s16 p) |
virtual int | getSpawnLevelAtPoint (v2s16 p) |
Static Public Member Functions | |
static u32 | getBlockSeed (v3s16 p, s32 seed) |
static u32 | getBlockSeed2 (v3s16 p, s32 seed) |
static MapgenType | getMapgenType (const std::string &mgname) |
static const char * | getMapgenName (MapgenType mgtype) |
static Mapgen * | createMapgen (MapgenType mgtype, MapgenParams *params, EmergeParams *emerge) |
static MapgenParams * | createMapgenParams (MapgenType mgtype) |
static void | getMapgenNames (std::vector< const char * > *mgnames, bool include_hidden) |
static void | setDefaultSettings (Settings *settings) |
Public Attributes | |
s32 | seed = 0 |
int | water_level = 0 |
int | mapgen_limit = 0 |
u32 | flags = 0 |
bool | generating = false |
int | id = -1 |
MMVManip * | vm = nullptr |
EmergeParams * | m_emerge = nullptr |
const NodeDefManager * | ndef = nullptr |
u32 | blockseed |
s16 * | heightmap = nullptr |
biome_t * | biomemap = nullptr |
v3s16 | csize |
BiomeGen * | biomegen = nullptr |
GenerateNotifier | gennotify |
Private Member Functions | |
void | lightSpread (VoxelArea &a, std::queue< std::pair< v3s16, u8 > > &queue, const v3s16 &p, u8 light) |
Spread light to the node at the given position, add to queue if changed. | |
bool | isLiquidHorizontallyFlowable (u32 vi, v3s16 em) |
|
default |
Mapgen::Mapgen | ( | int | mapgenid, |
MapgenParams * | params, | ||
EmergeParams * | emerge ) |
References csize, flags, m_emerge, MAP_BLOCKSIZE, mapgen_limit, EmergeParams::ndef, ndef, params, seed, and water_level.
|
virtual |
References m_emerge.
void Mapgen::calcLighting | ( | v3s16 | nmin, |
v3s16 | nmax, | ||
v3s16 | full_nmin, | ||
v3s16 | full_nmax, | ||
bool | propagate_shadow = true ) |
Run all lighting calculations.
nmin | Area to spread sunlight in |
nmax | ^ |
full_nmin | Area to recalculate light in |
full_nmax | ^ |
propagate_shadow | see propagateSunlight() |
References g_profiler, propagateSunlight(), spreadLight(), and SPT_AVG.
Referenced by ModApiMapgen::calc_lighting(), MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenV5::makeChunk(), MapgenV6::makeChunk(), MapgenV7::makeChunk(), and MapgenValleys::makeChunk().
|
static |
References MAPGEN_CARPATHIAN, MAPGEN_FLAT, MAPGEN_FRACTAL, MAPGEN_SINGLENODE, MAPGEN_V5, MAPGEN_V6, MAPGEN_V7, MAPGEN_VALLEYS, and params.
Referenced by EmergeManager::initMapgens().
|
static |
References MAPGEN_CARPATHIAN, MAPGEN_FLAT, MAPGEN_FRACTAL, MAPGEN_SINGLENODE, MAPGEN_V5, MAPGEN_V6, MAPGEN_V7, and MAPGEN_VALLEYS.
Referenced by MapSettingsManager::makeMapgenParams(), and setDefaultSettings().
Mapgen::DISABLE_CLASS_COPY | ( | Mapgen | ) |
s16 Mapgen::findGroundLevel | ( | v2s16 | p2d, |
s16 | ymin, | ||
s16 | ymax ) |
References VoxelArea::add_y(), NodeDefManager::get(), VoxelArea::getExtent(), VoxelArea::index(), VoxelManipulator::m_area, VoxelManipulator::m_data, MAX_MAP_GENERATION_LIMIT, ndef, vm, and ContentFeatures::walkable.
Referenced by Decoration::placeDeco(), and updateHeightmap().
s16 Mapgen::findLiquidSurface | ( | v2s16 | p2d, |
s16 | ymin, | ||
s16 | ymax ) |
References VoxelArea::add_y(), NodeDefManager::get(), VoxelArea::getExtent(), VoxelArea::index(), ContentFeatures::isLiquid(), VoxelManipulator::m_area, VoxelManipulator::m_data, MAX_MAP_GENERATION_LIMIT, ndef, vm, and ContentFeatures::walkable.
Referenced by Decoration::placeDeco().
|
static |
Referenced by ModApiMapgen::l_generate_decorations(), and ModApiMapgen::l_generate_ores().
|
static |
Referenced by MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenSinglenode::makeChunk(), MapgenV5::makeChunk(), MapgenV7::makeChunk(), and MapgenValleys::makeChunk().
|
static |
References ARRLEN, g_reg_mapgens, MAPGEN_INVALID, and MapgenDesc::name.
Referenced by Server::AsyncRunStep(), MapSettingsManager::makeMapgenParams(), and MapgenParams::writeParams().
|
static |
References ARRLEN, and g_reg_mapgens.
Referenced by ModApiMainMenu::l_get_mapgen_names().
|
static |
References ARRLEN, g_reg_mapgens, and MAPGEN_INVALID.
Referenced by MapSettingsManager::makeMapgenParams(), and MapgenParams::readParams().
|
inlinevirtual |
Reimplemented in MapgenCarpathian, MapgenFlat, MapgenFractal, MapgenSinglenode, MapgenV5, MapgenV6, MapgenV7, and MapgenValleys.
void Mapgen::getSurfaces | ( | v2s16 | p2d, |
s16 | ymin, | ||
s16 | ymax, | ||
std::vector< s16 > & | floors, | ||
std::vector< s16 > & | ceilings ) |
References VoxelArea::add_y(), NodeDefManager::get(), VoxelArea::getExtent(), VoxelArea::index(), VoxelManipulator::m_area, VoxelManipulator::m_data, ndef, vm, and ContentFeatures::walkable.
Referenced by Decoration::placeDeco().
|
inlinevirtual |
Reimplemented in MapgenCarpathian, MapgenFlat, MapgenFractal, MapgenSinglenode, MapgenV5, MapgenV6, MapgenV7, and MapgenValleys.
References MAPGEN_INVALID.
|
inlineprivate |
References VoxelArea::add_x(), VoxelArea::add_z(), CONTENT_IGNORE, ContentFeatures::floodable, NodeDefManager::get(), MapNode::getContent(), ContentFeatures::isLiquid(), VoxelManipulator::m_data, ndef, and vm.
Referenced by updateLiquid().
|
private |
Spread light to the node at the given position, add to queue if changed.
The given light value is diminished once.
a | VoxelArea being operated on |
queue | Queue for later lightSpread() calls |
p | Node position |
light | Light value (contains both banks) |
References VoxelArea::contains(), NodeDefManager::getLightingFlags(), VoxelArea::index(), ContentLightingFlags::light_propagates, VoxelManipulator::m_area, VoxelManipulator::m_data, MYMAX, ndef, p(), MapNode::param1, and vm.
Referenced by spreadLight().
|
inlinevirtual |
Reimplemented in MapgenCarpathian, MapgenFlat, MapgenFractal, MapgenSinglenode, MapgenV5, MapgenV6, MapgenV7, and MapgenValleys.
Referenced by EmergeThread::run().
Spread sunlight from the area above downwards.
Note that affected nodes have their night bank cleared so you want to run a light spread afterwards.
nmin | Area to operate on |
nmax | ^ |
propagate_shadow | Ignore obstructions above and spread sun anyway |
References VoxelArea::add_y(), CONTENT_IGNORE, MapNode::getContent(), VoxelArea::getExtent(), NodeDefManager::getLightingFlags(), VoxelArea::index(), LIGHT_SUN, VoxelManipulator::m_area, VoxelManipulator::m_data, VoxelArea::MaxEdge, VoxelArea::MinEdge, ndef, MapNode::param1, ContentLightingFlags::sunlight_propagates, vm, and water_level.
Referenced by calcLighting().
|
static |
References createMapgenParams(), flagdesc_mapgen, MAPGEN_INVALID, MG_BIOMES, MG_CAVES, MG_DECORATIONS, MG_DUNGEONS, MG_LIGHT, MG_ORES, params, and Settings::setDefault().
Referenced by set_default_settings().
Set light in entire area to fixed value.
light | Light value (contains both banks) |
nmin | Area to operate on |
nmax | ^ |
References g_profiler, VoxelArea::index(), VoxelManipulator::m_area, VoxelManipulator::m_data, VoxelArea::MaxEdge, VoxelArea::MinEdge, MapNode::param1, SPT_AVG, and vm.
Referenced by MapgenSinglenode::makeChunk(), and ModApiMapgen::set_lighting().
Spread light in the given area.
Artificial light is taken from nodedef, sunlight must already be set.
nmin | Area to operate on |
nmax | ^ |
References CONTENT_IGNORE, dir(), g_6dirs, MapNode::getContent(), NodeDefManager::getLightingFlags(), VoxelArea::index(), ContentLightingFlags::light_propagates, ContentLightingFlags::light_source, lightSpread(), VoxelManipulator::m_area, VoxelManipulator::m_data, VoxelArea::MaxEdge, VoxelArea::MinEdge, ndef, p(), MapNode::param1, and vm.
Referenced by calcLighting().
References findGroundLevel(), and heightmap.
Referenced by MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenV5::makeChunk(), MapgenV6::makeChunk(), MapgenV7::makeChunk(), and MapgenValleys::makeChunk().
void Mapgen::updateLiquid | ( | UniqueQueue< v3s16 > * | trans_liquid, |
v3s16 | nmin, | ||
v3s16 | nmax ) |
References VoxelArea::add_y(), CONTENT_IGNORE, ContentFeatures::floodable, NodeDefManager::get(), MapNode::getContent(), VoxelArea::getExtent(), VoxelArea::index(), ContentFeatures::isLiquid(), isLiquidHorizontallyFlowable(), VoxelManipulator::m_area, VoxelManipulator::m_data, ndef, UniqueQueue< Value >::push_back(), and vm.
Referenced by MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenSinglenode::makeChunk(), MapgenV5::makeChunk(), MapgenV6::makeChunk(), MapgenV7::makeChunk(), MapgenValleys::makeChunk(), and ModApiMapgen::update_liquids().
BiomeGen* Mapgen::biomegen = nullptr |
Referenced by MapgenBasic::MapgenBasic(), MapgenValleys::MapgenValleys(), MapgenBasic::generateBiomes(), MapgenBasic::generateCavesNoiseIntersection(), MapgenBasic::generateCavesRandomWalk(), MapgenBasic::generateDungeons(), ModApiMapgen::l_get_mapgen_object(), MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenV5::makeChunk(), and MapgenV7::makeChunk().
biome_t* Mapgen::biomemap = nullptr |
u32 Mapgen::blockseed |
Referenced by EmergeThread::finishGen(), MapgenV6::generateCaves(), MapgenBasic::generateCavesRandomWalk(), MapgenBasic::generateDungeons(), MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenSinglenode::makeChunk(), MapgenV5::makeChunk(), MapgenV6::makeChunk(), MapgenV7::makeChunk(), MapgenValleys::makeChunk(), MapgenV6::placeTreesAndJungleGrass(), and EmergeThread::run().
v3s16 Mapgen::csize |
Referenced by Mapgen(), MapgenBasic::MapgenBasic(), MapgenCarpathian::MapgenCarpathian(), MapgenFlat::MapgenFlat(), MapgenFractal::MapgenFractal(), MapgenV5::MapgenV5(), MapgenV6::MapgenV6(), MapgenV7::MapgenV7(), MapgenValleys::MapgenValleys(), MapgenBasic::generateCavernsNoise(), MapgenBasic::generateCavesNoiseIntersection(), ModApiMapgen::l_get_mapgen_object(), and MapgenV7::makeChunk().
u32 Mapgen::flags = 0 |
bool Mapgen::generating = false |
GenerateNotifier Mapgen::gennotify |
s16* Mapgen::heightmap = nullptr |
Referenced by MapgenBasic::MapgenBasic(), MapgenV6::MapgenV6(), MapgenBasic::~MapgenBasic(), MapgenV6::~MapgenV6(), MapgenV6::generateCaves(), MapgenBasic::generateCavesRandomWalk(), ModApiMapgen::l_get_mapgen_object(), Decoration::placeDeco(), MapgenV6::placeTreesAndJungleGrass(), and updateHeightmap().
int Mapgen::id = -1 |
EmergeParams* Mapgen::m_emerge = nullptr |
int Mapgen::mapgen_limit = 0 |
Referenced by Mapgen().
const NodeDefManager* Mapgen::ndef = nullptr |
Referenced by Mapgen(), MapgenBasic::MapgenBasic(), MapgenSinglenode::MapgenSinglenode(), MapgenV6::MapgenV6(), ModApiMapgen::calc_lighting(), MapgenBasic::dustTopNodes(), findGroundLevel(), findLiquidSurface(), MapgenV6::flowMud(), MapgenBasic::generateCavernsNoise(), MapgenV6::generateCaves(), MapgenBasic::generateCavesNoiseIntersection(), MapgenBasic::generateCavesRandomWalk(), MapgenBasic::generateDungeons(), getSurfaces(), MapgenV6::growGrass(), isLiquidHorizontallyFlowable(), ModApiMapgen::l_generate_decorations(), ModApiMapgen::l_generate_ores(), lightSpread(), MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenSinglenode::makeChunk(), MapgenV5::makeChunk(), MapgenV6::makeChunk(), MapgenV7::makeChunk(), MapgenValleys::makeChunk(), MapgenV6::placeTreesAndJungleGrass(), propagateSunlight(), spreadLight(), ModApiMapgen::update_liquids(), and updateLiquid().
s32 Mapgen::seed = 0 |
Referenced by Mapgen(), MapgenCarpathian::MapgenCarpathian(), MapgenFlat::MapgenFlat(), MapgenFractal::MapgenFractal(), MapgenV5::MapgenV5(), MapgenV6::MapgenV6(), MapgenV7::MapgenV7(), MapgenValleys::MapgenValleys(), MapgenV7::baseTerrainLevelAtPoint(), MapgenV6::baseTerrainLevelFromNoise(), MapgenBasic::generateCavernsNoise(), MapgenV6::generateCaves(), MapgenBasic::generateCavesNoiseIntersection(), MapgenBasic::generateCavesRandomWalk(), MapgenBasic::generateDungeons(), MapgenV6::get_blockseed(), MapgenV6::getBiome(), getBlockSeed(), getBlockSeed2(), MapgenV6::getHaveAppleTree(), MapgenV7::getMountainTerrainAtPoint(), MapgenCarpathian::getSpawnLevelAtPoint(), MapgenFlat::getSpawnLevelAtPoint(), MapgenFractal::getSpawnLevelAtPoint(), MapgenV5::getSpawnLevelAtPoint(), MapgenV7::getSpawnLevelAtPoint(), MapgenValleys::getSpawnLevelAtPoint(), MapgenV6::getTreeAmount(), ModApiMapgen::l_generate_decorations(), ModApiMapgen::l_generate_ores(), MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenV5::makeChunk(), MapgenV6::makeChunk(), MapgenV7::makeChunk(), MapgenValleys::makeChunk(), and Ore::placeOre().
MMVManip* Mapgen::vm = nullptr |
Referenced by MapgenV6::addMud(), ModApiMapgen::calc_lighting(), MapgenBasic::dustTopNodes(), MapgenV6::find_stone_level(), findGroundLevel(), findLiquidSurface(), EmergeThread::finishGen(), MapgenV6::flowMud(), MapgenV5::generateBaseTerrain(), MapgenBasic::generateBiomes(), MapgenBasic::generateCavernsNoise(), MapgenV6::generateCaves(), MapgenBasic::generateCavesNoiseIntersection(), MapgenBasic::generateCavesRandomWalk(), MapgenBasic::generateDungeons(), MapgenV6::generateGround(), MapgenCarpathian::generateTerrain(), MapgenFlat::generateTerrain(), MapgenFractal::generateTerrain(), MapgenV7::generateTerrain(), MapgenValleys::generateTerrain(), getSurfaces(), MapgenV6::growGrass(), isLiquidHorizontallyFlowable(), ModApiMapgen::l_generate_decorations(), ModApiMapgen::l_generate_ores(), ModApiMapgen::l_get_mapgen_object(), lightSpread(), MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenSinglenode::makeChunk(), MapgenV5::makeChunk(), MapgenV6::makeChunk(), MapgenV7::makeChunk(), MapgenValleys::makeChunk(), MapgenV6::moveMud(), Decoration::placeDeco(), Ore::placeOre(), MapgenV6::placeTreesAndJungleGrass(), propagateSunlight(), ModApiMapgen::set_lighting(), setLighting(), spreadLight(), ModApiMapgen::update_liquids(), updateLiquid(), and ServerMap::updateVManip().
int Mapgen::water_level = 0 |
Referenced by Mapgen(), MapgenCarpathian::MapgenCarpathian(), MapgenV6::addMud(), MapgenV6::baseTerrainLevelFromMap(), MapgenV6::baseTerrainLevelFromNoise(), MapgenV6::block_is_underground(), ModApiMapgen::calc_lighting(), MapgenBasic::dustTopNodes(), MapgenV5::generateBaseTerrain(), MapgenBasic::generateBiomes(), MapgenV6::generateCaves(), MapgenBasic::generateCavesRandomWalk(), MapgenV6::generateGround(), MapgenCarpathian::generateTerrain(), MapgenFlat::generateTerrain(), MapgenFractal::generateTerrain(), MapgenV7::generateTerrain(), MapgenValleys::generateTerrain(), MapgenV7::getRiverChannelFromMap(), MapgenCarpathian::getSpawnLevelAtPoint(), MapgenFlat::getSpawnLevelAtPoint(), MapgenFractal::getSpawnLevelAtPoint(), MapgenV5::getSpawnLevelAtPoint(), MapgenV6::getSpawnLevelAtPoint(), MapgenV7::getSpawnLevelAtPoint(), MapgenValleys::getSpawnLevelAtPoint(), MapgenV6::growGrass(), MapgenV6::placeTreesAndJungleGrass(), and propagateSunlight().