本文整理汇总了C++中Chunk::SetGrid方法的典型用法代码示例。如果您正苦于以下问题:C++ Chunk::SetGrid方法的具体用法?C++ Chunk::SetGrid怎么用?C++ Chunk::SetGrid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chunk
的用法示例。
在下文中一共展示了Chunk::SetGrid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateNewChunk
// Chunk Creation
void ChunkManager::CreateNewChunk(int x, int y, int z)
{
ChunkCoordKeys coordKeys;
coordKeys.x = x;
coordKeys.y = y;
coordKeys.z = z;
// Create a new chunk at this grid position
Chunk* pNewChunk = new Chunk(m_pRenderer, this, m_pVoxSettings);
pNewChunk->SetPlayer(m_pPlayer);
pNewChunk->SetSceneryManager(m_pSceneryManager);
float xPos = x * (Chunk::CHUNK_SIZE * Chunk::BLOCK_RENDER_SIZE*2.0f);
float yPos = y * (Chunk::CHUNK_SIZE * Chunk::BLOCK_RENDER_SIZE*2.0f);
float zPos = z * (Chunk::CHUNK_SIZE * Chunk::BLOCK_RENDER_SIZE*2.0f);
pNewChunk->SetPosition(vec3(xPos, yPos, zPos));
pNewChunk->SetGrid(coordKeys.x, coordKeys.y, coordKeys.z);
m_ChunkMapMutexLock.lock();
m_chunksMap[coordKeys] = pNewChunk;
m_ChunkMapMutexLock.unlock();
pNewChunk->Setup();
pNewChunk->SetNeedsRebuild(false, true);
pNewChunk->RebuildMesh();
pNewChunk->CompleteMesh();
pNewChunk->SetCreated(true);
UpdateChunkNeighbours(pNewChunk, x, y, z);
}
示例2: CreateNewChunk
void ChunkManager::CreateNewChunk(int x, int y, int z) {
ChunkCoordKey key(x, y, z);
//std::cout << "Create chunk: " << key.x << " " << key.y << " " << key.z << std::endl;
Chunk* chunk = new Chunk(m_renderer, this);
chunk->SetGrid(x, y, z);
m_chunkMapMutex.lock();
m_chunkMap[key] = chunk;
m_chunkMapMutex.unlock();
chunk->Load();
chunk->SetNeedsRebuild(true, true);
chunk->RebuildMesh();
// UpdateChunkNeighbors(chunk, x, y, z);
}