Minetest  5.4.0
MeshUpdateQueue Class Reference

#include <mesh_generator_thread.h>

+ Collaboration diagram for MeshUpdateQueue:

Public Member Functions

 MeshUpdateQueue (Client *client)
 
 ~MeshUpdateQueue ()
 
void addBlock (Map *map, v3s16 p, bool ack_block_to_server, bool urgent)
 
QueuedMeshUpdatepop ()
 
u32 size ()
 

Private Types

enum  UpdateMode { FORCE_UPDATE , SKIP_UPDATE_IF_ALREADY_CACHED }
 

Private Member Functions

CachedMapBlockDatacacheBlock (Map *map, v3s16 p, UpdateMode mode, size_t *cache_hit_counter=NULL)
 
CachedMapBlockDatagetCachedBlock (const v3s16 &p)
 
void fillDataFromMapBlockCache (QueuedMeshUpdate *q)
 
void cleanupCache ()
 

Private Attributes

Clientm_client
 
std::vector< QueuedMeshUpdate * > m_queue
 
std::set< v3s16m_urgents
 
std::map< v3s16, CachedMapBlockData * > m_cache
 
std::mutex m_mutex
 
bool m_cache_enable_shaders
 
bool m_cache_smooth_lighting
 
int m_meshgen_block_cache_size
 

Member Enumeration Documentation

◆ UpdateMode

Enumerator
FORCE_UPDATE 
SKIP_UPDATE_IF_ALREADY_CACHED 

Constructor & Destructor Documentation

◆ MeshUpdateQueue()

MeshUpdateQueue::MeshUpdateQueue ( Client client)

References g_settings, Settings::getBool(), Settings::getS32(), m_cache_enable_shaders, m_cache_smooth_lighting, and m_meshgen_block_cache_size.

+ Here is the call graph for this function:

◆ ~MeshUpdateQueue()

MeshUpdateQueue::~MeshUpdateQueue ( )

References m_cache, m_mutex, and m_queue.

Member Function Documentation

◆ addBlock()

void MeshUpdateQueue::addBlock ( Map map,
v3s16  p,
bool  ack_block_to_server,
bool  urgent 
)

References QueuedMeshUpdate::ack_block_to_server, Profiler::avg(), cacheBlock(), cleanupCache(), QueuedMeshUpdate::crack_level, QueuedMeshUpdate::crack_pos, FORCE_UPDATE, g_profiler, Client::getCrackLevel(), Client::getCrackPos(), m_client, m_mutex, m_queue, m_urgents, QueuedMeshUpdate::p, p(), and SKIP_UPDATE_IF_ALREADY_CACHED.

Referenced by MeshUpdateThread::updateBlock().

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

◆ cacheBlock()

CachedMapBlockData * MeshUpdateQueue::cacheBlock ( Map map,
v3s16  p,
UpdateMode  mode,
size_t *  cache_hit_counter = NULL 
)
private

References CachedMapBlockData::data, Map::getBlockNoCreateNoEx(), MapBlock::getData(), m_cache, MAP_BLOCKSIZE, p(), and SKIP_UPDATE_IF_ALREADY_CACHED.

Referenced by addBlock().

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

◆ cleanupCache()

void MeshUpdateQueue::cleanupCache ( )
private

References Profiler::avg(), g_profiler, CachedMapBlockData::last_used_timestamp, m_cache, m_meshgen_block_cache_size, MAP_BLOCKSIZE, MYMAX, and CachedMapBlockData::refcount_from_queue.

Referenced by addBlock().

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

◆ fillDataFromMapBlockCache()

void MeshUpdateQueue::fillDataFromMapBlockCache ( QueuedMeshUpdate q)
private

References QueuedMeshUpdate::crack_level, QueuedMeshUpdate::crack_pos, CachedMapBlockData::data, QueuedMeshUpdate::data, MeshMakeData::fillBlockData(), MeshMakeData::fillBlockDataBegin(), getCachedBlock(), CachedMapBlockData::last_used_timestamp, m_cache_enable_shaders, m_cache_smooth_lighting, m_client, QueuedMeshUpdate::p, p(), CachedMapBlockData::refcount_from_queue, MeshMakeData::setCrack(), and MeshMakeData::setSmoothLighting().

Referenced by pop().

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

◆ getCachedBlock()

CachedMapBlockData * MeshUpdateQueue::getCachedBlock ( const v3s16 p)
private

References m_cache, and p().

Referenced by fillDataFromMapBlockCache().

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

◆ pop()

QueuedMeshUpdate * MeshUpdateQueue::pop ( )

References fillDataFromMapBlockCache(), m_mutex, m_queue, m_urgents, and QueuedMeshUpdate::p.

Referenced by MeshUpdateThread::doUpdate().

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

◆ size()

u32 MeshUpdateQueue::size ( )
inline

References m_mutex, and m_queue.

Member Data Documentation

◆ m_cache

std::map<v3s16, CachedMapBlockData *> MeshUpdateQueue::m_cache
private

◆ m_cache_enable_shaders

bool MeshUpdateQueue::m_cache_enable_shaders
private

◆ m_cache_smooth_lighting

bool MeshUpdateQueue::m_cache_smooth_lighting
private

◆ m_client

Client* MeshUpdateQueue::m_client
private

◆ m_meshgen_block_cache_size

int MeshUpdateQueue::m_meshgen_block_cache_size
private

Referenced by MeshUpdateQueue(), and cleanupCache().

◆ m_mutex

std::mutex MeshUpdateQueue::m_mutex
private

Referenced by ~MeshUpdateQueue(), addBlock(), pop(), and size().

◆ m_queue

std::vector<QueuedMeshUpdate *> MeshUpdateQueue::m_queue
private

Referenced by ~MeshUpdateQueue(), addBlock(), pop(), and size().

◆ m_urgents

std::set<v3s16> MeshUpdateQueue::m_urgents
private

Referenced by addBlock(), and pop().


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