Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
Mapgen Class Reference

#include <mapgen.h>

+ Inheritance diagram for Mapgen:
+ Collaboration diagram for Mapgen:

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 MapgencreateMapgen (MapgenType mgtype, MapgenParams *params, EmergeParams *emerge)
 
static MapgenParamscreateMapgenParams (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
 
MMVManipvm = nullptr
 
EmergeParamsm_emerge = nullptr
 
const NodeDefManagerndef = nullptr
 
u32 blockseed
 
s16 * heightmap = nullptr
 
biome_tbiomemap = nullptr
 
v3s16 csize
 
BiomeGenbiomegen = 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)
 

Constructor & Destructor Documentation

◆ Mapgen() [1/2]

Mapgen::Mapgen ( )
default

◆ Mapgen() [2/2]

◆ ~Mapgen()

Mapgen::~Mapgen ( )
virtual

References m_emerge.

Member Function Documentation

◆ calcLighting()

void Mapgen::calcLighting ( v3s16 nmin,
v3s16 nmax,
v3s16 full_nmin,
v3s16 full_nmax,
bool propagate_shadow = true )

Run all lighting calculations.

Parameters
nminArea to spread sunlight in
nmax^
full_nminArea to recalculate light in
full_nmax^
propagate_shadowsee 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createMapgen()

Mapgen * Mapgen::createMapgen ( MapgenType mgtype,
MapgenParams * params,
EmergeParams * emerge )
static

References MAPGEN_CARPATHIAN, MAPGEN_FLAT, MAPGEN_FRACTAL, MAPGEN_SINGLENODE, MAPGEN_V5, MAPGEN_V6, MAPGEN_V7, and MAPGEN_VALLEYS.

Referenced by EmergeManager::initMapgens().

+ Here is the caller graph for this function:

◆ createMapgenParams()

MapgenParams * Mapgen::createMapgenParams ( MapgenType mgtype)
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().

+ Here is the caller graph for this function:

◆ DISABLE_CLASS_COPY()

Mapgen::DISABLE_CLASS_COPY ( Mapgen )

◆ findGroundLevel()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findLiquidSurface()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBlockSeed()

u32 Mapgen::getBlockSeed ( v3s16 p,
s32 seed )
static

References p(), and seed.

Referenced by ModApiMapgen::l_generate_decorations(), and ModApiMapgen::l_generate_ores().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getBlockSeed2()

u32 Mapgen::getBlockSeed2 ( v3s16 p,
s32 seed )
static

References p(), and seed.

Referenced by MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenSinglenode::makeChunk(), MapgenV5::makeChunk(), MapgenV7::makeChunk(), and MapgenValleys::makeChunk().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGroundLevelAtPoint()

virtual int Mapgen::getGroundLevelAtPoint ( v2s16 p)
inlinevirtual

Reimplemented in MapgenV6.

◆ getMapgenName()

const char * Mapgen::getMapgenName ( MapgenType mgtype)
static

References ARRLEN, g_reg_mapgens, MAPGEN_INVALID, and MapgenDesc::name.

Referenced by Server::AsyncRunStep(), MapSettingsManager::makeMapgenParams(), and MapgenParams::writeParams().

+ Here is the caller graph for this function:

◆ getMapgenNames()

void Mapgen::getMapgenNames ( std::vector< const char * > * mgnames,
bool include_hidden )
static

References ARRLEN, and g_reg_mapgens.

Referenced by ModApiMainMenu::l_get_mapgen_names().

+ Here is the caller graph for this function:

◆ getMapgenType()

MapgenType Mapgen::getMapgenType ( const std::string & mgname)
static

References ARRLEN, g_reg_mapgens, and MAPGEN_INVALID.

Referenced by MapSettingsManager::makeMapgenParams(), and MapgenParams::readParams().

+ Here is the caller graph for this function:

◆ getSpawnLevelAtPoint()

virtual int Mapgen::getSpawnLevelAtPoint ( v2s16 p)
inlinevirtual

◆ getSurfaces()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getType()

virtual MapgenType Mapgen::getType ( ) const
inlinevirtual

◆ isLiquidHorizontallyFlowable()

bool Mapgen::isLiquidHorizontallyFlowable ( u32 vi,
v3s16 em )
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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lightSpread()

void Mapgen::lightSpread ( VoxelArea & a,
std::queue< std::pair< v3s16, u8 > > & queue,
const v3s16 & p,
u8 light )
private

Spread light to the node at the given position, add to queue if changed.

The given light value is diminished once.

Parameters
aVoxelArea being operated on
queueQueue for later lightSpread() calls
pNode position
lightLight 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeChunk()

virtual void Mapgen::makeChunk ( BlockMakeData * data)
inlinevirtual

Reimplemented in MapgenCarpathian, MapgenFlat, MapgenFractal, MapgenSinglenode, MapgenV5, MapgenV6, MapgenV7, and MapgenValleys.

Referenced by EmergeThread::run().

+ Here is the caller graph for this function:

◆ propagateSunlight()

void Mapgen::propagateSunlight ( v3s16 nmin,
v3s16 nmax,
bool propagate_shadow )

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.

Parameters
nminArea to operate on
nmax^
propagate_shadowIgnore 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDefaultSettings()

void Mapgen::setDefaultSettings ( Settings * settings)
static

References createMapgenParams(), flagdesc_mapgen, MAPGEN_INVALID, MG_BIOMES, MG_CAVES, MG_DECORATIONS, MG_DUNGEONS, MG_LIGHT, MG_ORES, MapgenParams::setDefaultSettings(), and settings.

Referenced by set_default_settings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLighting()

void Mapgen::setLighting ( u8 light,
v3s16 nmin,
v3s16 nmax )

Set light in entire area to fixed value.

Parameters
lightLight value (contains both banks)
nminArea 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ spreadLight()

void Mapgen::spreadLight ( const v3s16 & nmin,
const v3s16 & nmax )

Spread light in the given area.

Artificial light is taken from nodedef, sunlight must already be set.

Parameters
nminArea 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateHeightmap()

void Mapgen::updateHeightmap ( v3s16 nmin,
v3s16 nmax )

References findGroundLevel(), and heightmap.

Referenced by MapgenCarpathian::makeChunk(), MapgenFlat::makeChunk(), MapgenFractal::makeChunk(), MapgenV5::makeChunk(), MapgenV6::makeChunk(), MapgenV7::makeChunk(), and MapgenValleys::makeChunk().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateLiquid()

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ biomegen

◆ biomemap

◆ blockseed

◆ csize

◆ flags

◆ generating

◆ gennotify

◆ heightmap

◆ id

int Mapgen::id = -1

◆ m_emerge

◆ mapgen_limit

int Mapgen::mapgen_limit = 0

Referenced by Mapgen().

◆ ndef

◆ seed

◆ vm

◆ water_level


The documentation for this class was generated from the following files: