#include <World.hpp>
◆ World() [1/3]
World::World |
( |
bool |
save = false | ) |
|
◆ ~World()
◆ World() [2/3]
World::World |
( |
World & |
other | ) |
|
|
delete |
◆ World() [3/3]
World::World |
( |
World && |
other | ) |
|
|
delete |
◆ getBlockChunkPosition()
glm::vec3 World::getBlockChunkPosition |
( |
const glm::vec3 & |
position | ) |
|
|
static |
will return the block position relative to the chunk
- Parameters
-
position | the position of the block in the world |
- Returns
- glm::vec3
◆ getChunk()
std::shared_ptr< Chunk > World::getChunk |
( |
const glm::ivec3 & |
position | ) |
|
Get the Chunk object.
- Parameters
-
- Return values
-
std::shared_ptr<Chunk> | if the chunk exists |
nullptr | if the chunk does not exist |
◆ getChunkNoLock()
std::shared_ptr< Chunk > World::getChunkNoLock |
( |
const glm::ivec3 & |
position | ) |
|
|
protected |
Get a chunk ptr without locking the chunks mutex.
- Warning
- you MUST lock the chunks mutex before calling this function
- Parameters
-
- Return values
-
std::shared_ptr<Chunk> | if the chunk exists |
nullptr | if the chunk does not exist |
◆ getChunkPosition()
glm::vec3 World::getChunkPosition |
( |
const glm::vec3 & |
position | ) |
|
|
static |
will return the chunk position containing the block
- Parameters
-
position | the position of the block in the world |
- Returns
- glm::vec3
◆ getSave()
Save & World::getSave |
( |
| ) |
|
◆ getWorldGenerator()
◆ insertChunk()
void World::insertChunk |
( |
const glm::ivec3 & |
position, |
|
|
std::shared_ptr< Chunk > |
chunk |
|
) |
| |
◆ insertChunkNoLock()
void World::insertChunkNoLock |
( |
const glm::ivec3 & |
position, |
|
|
std::shared_ptr< Chunk > |
chunk |
|
) |
| |
|
protected |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ TracyLockableN() [1/3]
World::TracyLockableN |
( |
std::mutex |
, |
|
|
m_chunks_mutex |
, |
|
|
"Chunks" |
|
|
) |
| |
|
mutableprotected |
◆ TracyLockableN() [2/3]
World::TracyLockableN |
( |
std::mutex |
, |
|
|
m_mobs_mutex |
, |
|
|
"Mobs" |
|
|
) |
| |
|
protected |
◆ TracyLockableN() [3/3]
World::TracyLockableN |
( |
std::mutex |
, |
|
|
m_players_mutex |
, |
|
|
"Players" |
|
|
) |
| |
|
protected |
◆ unloadRegion()
void World::unloadRegion |
( |
const glm::ivec2 |
region_pos | ) |
|
Unloads all chunk inside a region, if save is enabled, will save the region in a region file.
- Parameters
-
region_pos | calculated with Save::Region::toRegionPos |
◆ updateBlockLight()
std::unordered_set< glm::ivec3 > World::updateBlockLight |
( |
const glm::ivec3 & |
block_position | ) |
|
|
protected |
Update the block light of the chunk containing the block.
- Parameters
-
block_position | the position of the block in the world |
- Returns
- a set of chunks that have been modified ( and might need remeshing )
◆ updateSkyLight()
std::unordered_set< glm::ivec3 > World::updateSkyLight |
( |
const glm::ivec3 & |
block_position | ) |
|
|
protected |
Update the sky light of the chunk containing the block.
- Parameters
-
block_position | the position of the block in the world |
- Returns
- a set of chunks that have been modified ( and might need remeshing )
◆ m_chunks
std::unordered_map<glm::ivec3, std::shared_ptr<Chunk> > World::m_chunks |
|
protected |
◆ m_executor
◆ m_mob_id
uint64_t World::m_mob_id = 0 |
|
protected |
◆ m_mobs
std::unordered_map<uint64_t, std::shared_ptr<Mob> > World::m_mobs |
|
protected |
◆ m_players
std::unordered_map<uint64_t, std::shared_ptr<Player> > World::m_players |
|
protected |
◆ m_save
std::unique_ptr<Save> World::m_save |
|
protected |
◆ m_world_generator
The documentation for this class was generated from the following files: