本文整理汇总了C++中MapBlock::isGenerated方法的典型用法代码示例。如果您正苦于以下问题:C++ MapBlock::isGenerated方法的具体用法?C++ MapBlock::isGenerated怎么用?C++ MapBlock::isGenerated使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapBlock
的用法示例。
在下文中一共展示了MapBlock::isGenerated方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBlockOrStartGen
bool EmergeThread::getBlockOrStartGen(v3s16 p, MapBlock **b,
BlockMakeData *data, bool allow_gen) {
v2s16 p2d(p.X, p.Z);
//envlock: usually takes <=1ms, sometimes 90ms or ~400ms to acquire
JMutexAutoLock envlock(m_server->m_env_mutex);
// Load sector if it isn't loaded
if (map->getSectorNoGenerateNoEx(p2d) == NULL)
map->loadSectorMeta(p2d);
// Attempt to load block
MapBlock *block = map->getBlockNoCreateNoEx(p);
if (!block || block->isDummy() || !block->isGenerated()) {
EMERGE_DBG_OUT("not in memory, attempting to load from disk");
block = map->loadBlock(p);
if (block && block->isGenerated())
map->prepareBlock(block);
}
// If could not load and allowed to generate,
// start generation inside this same envlock
if (allow_gen && (block == NULL || !block->isGenerated())) {
EMERGE_DBG_OUT("generating");
*b = block;
return map->initBlockMake(data, p);
}
*b = block;
return false;
}
示例2: getBlockOrStartGen
bool EmergeThread::getBlockOrStartGen(v3s16 p, MapBlock **b,
BlockMakeData *data, bool allow_gen) {
//envlock: usually takes <=1ms, sometimes 90ms or ~400ms to acquire
//JMutexAutoLock envlock(m_server->m_env_mutex);
// Attempt to load block
MapBlock *block = map->getBlockNoCreateNoEx(p);
if (!block || block->isDummy()) {
EMERGE_DBG_OUT("not in memory, attempting to load from disk ag="<<allow_gen<<" block="<<block<<" p="<<p);
block = map->loadBlock(p);
if(block)
{
// block->pushElementsToCircuit(m_circuit);
// m_circuit->processElementsQueue(*map, map->getNodeDefManager());
}
if (block && block->isGenerated())
map->prepareBlock(block);
}
// If could not load and allowed to generate,
// start generation inside this same envlock
if (allow_gen && (!block)) {
EMERGE_DBG_OUT("generating b="<<block);
*b = block;
return map->initBlockMake(data, p);
}
*b = block;
return false;
}
示例3: getBlockOrStartGen
bool EmergeThread::getBlockOrStartGen(v3s16 p, MapBlock **b,
BlockMakeData *data, bool allow_gen)
{
#if !ENABLE_THREADS
auto lock = map->m_nothread_locker.lock_unique_rec();
#endif
MapBlock *block;
{
//envlock: usually takes <=1ms, sometimes 90ms or ~400ms to acquire
//JMutexAutoLock envlock(m_server->m_env_mutex);
// Attempt to load block
block = map->getBlockNoCreateNoEx(p);
if (!block || block->isDummy()) {
EMERGE_DBG_OUT("not in memory, attempting to load from disk ag="<<allow_gen<<" block="<<block<<" p="<<p);
block = map->loadBlock(p);
if (block && block->isGenerated())
map->prepareBlock(block);
}
}
// If could not load and allowed to generate,
// start generation inside this same envlock
if (allow_gen && (!block)) {
EMERGE_DBG_OUT("generating b="<<block);
*b = block;
return map->initBlockMake(data, p);
}
*b = block;
return false;
}
示例4: GetNextBlocks
//.........这里部分代码省略.........
f32 dist;
if (!isBlockInSight(p, camera_pos, camera_dir, camera_fov, d_blocks_in_sight, &dist)) {
continue;
}
/*
Don't send already sent blocks
*/
{
if(m_blocks_sent.find(p) != m_blocks_sent.end())
{
continue;
}
}
/*
Check if map has this block
*/
MapBlock *block = env->getMap().getBlockNoCreateNoEx(p);
bool surely_not_found_on_disk = false;
bool block_is_invalid = false;
if (block) {
// Reset usage timer, this block will be of use in the future.
block->resetUsageTimer();
// Block is dummy if data doesn't exist.
// It means it has been not found from disk and not generated
if (block->isDummy()) {
surely_not_found_on_disk = true;
}
if (!block->isGenerated())
block_is_invalid = true;
/*
If block is not close, don't send it unless it is near
ground level.
Block is near ground level if night-time mesh
differs from day-time mesh.
*/
if (d >= d_opt) {
if (!block->getDayNightDiff())
continue;
}
if (occ_cull && !block_is_invalid &&
env->getMap().isBlockOccluded(block, cam_pos_nodes)) {
continue;
}
}
/*
If block has been marked to not exist on disk (dummy)
and generating new ones is not wanted, skip block.
*/
if (!generate && surely_not_found_on_disk) {
// get next one.
continue;
}
/*
Add inexistent block to emerge queue.
*/
示例5: GetNextBlocks
//.........这里部分代码省略.........
/*
Check if map has this block
*/
MapBlock *block = env->getMap().getBlockNoCreateNoEx(p);
bool surely_not_found_on_disk = false;
bool block_is_invalid = false;
if(block != NULL)
{
if (m_blocks_sent[p] > 0 && m_blocks_sent[p] >= block->m_changed_timestamp) {
continue;
}
// Reset usage timer, this block will be of use in the future.
block->resetUsageTimer();
// Block is dummy if data doesn't exist.
// It means it has been not found from disk and not generated
if(block->isDummy())
{
surely_not_found_on_disk = true;
}
if (block->getLightingExpired()) {
continue;
}
// Block is valid if lighting is up-to-date and data exists
if(block->isValid() == false)
{
block_is_invalid = true;
}
if(block->isGenerated() == false)
{
continue;
}
/*
If block is not close, don't send it unless it is near
ground level.
Block is near ground level if night-time mesh
differs from day-time mesh.
*/
/*
if(d >= 4)
{
if(block->getDayNightDiff() == false)
continue;
}
*/
}
/*
If block has been marked to not exist on disk (dummy)
and generating new ones is not wanted, skip block.
*/
if(generate == false && surely_not_found_on_disk == true)
{
// get next one.
continue;
}
/*
Add inexistent block to emerge queue.
示例6: GetNextBlocks
//.........这里部分代码省略.........
step, stepfac, startoff, endoff, needed_count, nodemgr, occlude_cache) &&
isOccluded(&env->getMap(), spn, cpn + v3POS(-bs2,bs2,-bs2),
step, stepfac, startoff, endoff, needed_count, nodemgr, occlude_cache) &&
isOccluded(&env->getMap(), spn, cpn + v3POS(-bs2,-bs2,bs2),
step, stepfac, startoff, endoff, needed_count, nodemgr, occlude_cache) &&
isOccluded(&env->getMap(), spn, cpn + v3POS(-bs2,-bs2,-bs2),
step, stepfac, startoff, endoff, needed_count, nodemgr, occlude_cache)
)
{
//infostream<<" occlusion player="<<cam_pos_nodes<<" d="<<d<<" block="<<cpn<<" total="<<blocks_occlusion_culled<<"/"<<num_blocks_selected<<std::endl;
g_profiler->add("SMap: Occlusion skip", 1);
blocks_occlusion_culled++;
continue;
}
}
// Reset usage timer, this block will be of use in the future.
block->resetUsageTimer();
if (block->getLightingExpired()) {
//env->getServerMap().lighting_modified_blocks.set(p, nullptr);
env->getServerMap().lighting_modified_add(p, d);
}
if (block->lighting_broken > 0 && (block_sent || d > 0))
continue;
// Block is valid if lighting is up-to-date and data exists
if(block->isValid() == false)
{
block_is_invalid = true;
}
if(block->isGenerated() == false)
{
continue;
}
/*
If block is not close, don't send it unless it is near
ground level.
Block is near ground level if night-time mesh
differs from day-time mesh.
*/
/*
if(d >= 4)
{
if(block->getDayNightDiff() == false)
continue;
}
*/
}
/*
If block has been marked to not exist on disk (dummy)
and generating new ones is not wanted, skip block.
*/
if(generate == false && surely_not_found_on_disk == true)
{
// get next one.
continue;
}
/*
Add inexistent block to emerge queue.