本文整理汇总了C++中MapBlock::copyTo方法的典型用法代码示例。如果您正苦于以下问题:C++ MapBlock::copyTo方法的具体用法?C++ MapBlock::copyTo怎么用?C++ MapBlock::copyTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapBlock
的用法示例。
在下文中一共展示了MapBlock::copyTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fill
void MeshMakeData::fill(MapBlock *block)
{
m_blockpos = block->getPos();
v3s16 blockpos_nodes = m_blockpos*MAP_BLOCKSIZE;
/*
Copy data
*/
// Allocate this block + neighbors
m_vmanip.clear();
m_vmanip.addArea(VoxelArea(blockpos_nodes-v3s16(1,1,1)*MAP_BLOCKSIZE,
blockpos_nodes+v3s16(1,1,1)*MAP_BLOCKSIZE*2-v3s16(1,1,1)));
{
//TimeTaker timer("copy central block data");
// 0ms
// Copy our data
block->copyTo(m_vmanip);
}
{
//TimeTaker timer("copy neighbor block data");
// 0ms
/*
Copy neighbors. This is lightning fast.
Copying only the borders would be *very* slow.
*/
// Get map
Map *map = block->getParent();
for(u16 i=0; i<26; i++)
{
const v3s16 &dir = g_26dirs[i];
v3s16 bp = m_blockpos + dir;
MapBlock *b = map->getBlockNoCreateNoEx(bp);
if(b)
b->copyTo(m_vmanip);
}
}
}
示例2: voxel_area
void Map::copy_27_blocks_to_vm(MapBlock * block, VoxelManipulator & vmanip) {
v3POS blockpos = block->getPos();
v3POS blockpos_nodes = blockpos * MAP_BLOCKSIZE;
// Allocate this block + neighbors
vmanip.clear();
VoxelArea voxel_area(blockpos_nodes - v3POS(1, 1, 1) * MAP_BLOCKSIZE,
blockpos_nodes + v3POS(1, 1, 1) * MAP_BLOCKSIZE * 2 - v3POS(1, 1, 1));
vmanip.addArea(voxel_area);
block->copyTo(vmanip);
auto * map = block->getParent();
for(u16 i = 0; i < 26; i++) {
v3POS bp = blockpos + g_26dirs[i];
MapBlock *b = map->getBlockNoCreateNoEx(bp);
if(b)
b->copyTo(vmanip);
}
}