本文整理汇总了C++中Chunk::Render方法的典型用法代码示例。如果您正苦于以下问题:C++ Chunk::Render方法的具体用法?C++ Chunk::Render怎么用?C++ Chunk::Render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chunk
的用法示例。
在下文中一共展示了Chunk::Render方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderChunks
void World::RenderChunks() {
for(int i = 0; i < m_vpChunksToRender.size(); i++) {
Chunk* pChunk = m_vpChunksToRender[i];
if(pChunk->MeshBuilt()) {
pChunk->Render();
}
}
}
示例2: Render
// Rendering
void ChunkManager::Render(bool shadowRender)
{
if (shadowRender == false)
{
m_numChunksRender = 0;
}
m_pRenderer->StartMeshRender();
// Store cull mode
CullMode cullMode = m_pRenderer->GetCullMode();
if (m_wireframeRender)
{
m_pRenderer->SetLineWidth(1.0f);
m_pRenderer->SetRenderMode(RM_WIREFRAME);
}
else
{
m_pRenderer->SetRenderMode(RM_SOLID);
}
m_pRenderer->PushMatrix();
m_ChunkMapMutexLock.lock();
typedef map<ChunkCoordKeys, Chunk*>::iterator it_type;
for (it_type iterator = m_chunksMap.begin(); iterator != m_chunksMap.end(); iterator++)
{
Chunk* pChunk = iterator->second;
if (pChunk != NULL && pChunk->IsCreated())
{
vec3 chunkCenter = pChunk->GetPosition() + vec3((Chunk::CHUNK_SIZE * Chunk::BLOCK_RENDER_SIZE) - Chunk::BLOCK_RENDER_SIZE, (Chunk::CHUNK_SIZE * Chunk::BLOCK_RENDER_SIZE) - Chunk::BLOCK_RENDER_SIZE, (Chunk::CHUNK_SIZE * Chunk::BLOCK_RENDER_SIZE) - Chunk::BLOCK_RENDER_SIZE);
if (shadowRender == true || m_pRenderer->SphereInFrustum(VoxGame::GetInstance()->GetDefaultViewport(), chunkCenter, Chunk::CHUNK_RADIUS))
{
pChunk->Render();
if (shadowRender == false)
{
m_numChunksRender++;
}
}
}
}
m_ChunkMapMutexLock.unlock();
m_pRenderer->PopMatrix();
// Restore cull mode
m_pRenderer->SetCullMode(cullMode);
m_pRenderer->EndMeshRender();
}
示例3: Render
void ChunkManager::Render() {
if (m_textureId != -1) {
m_renderer->BindTextureToShader(m_textureId, 0);
}
m_renderer->PushMatrix();
m_chunkMapMutex.lock();
std::map<ChunkCoordKey, Chunk*>::iterator it;
for (it = m_chunkMap.begin(); it != m_chunkMap.end(); ++it) {
Chunk* chunk = it->second;
if (chunk->IsLoaded()) {
glm::vec3 chunkCenter = chunk->GetCenter();
float chunkSize = Chunk::CHUNK_SIZE * Chunk::BLOCK_RENDER_SIZE;
if (m_renderer->CubeInFrustum(chunkCenter, chunkSize, chunkSize, chunkSize)) {
chunk->Render();
}
}
}
m_chunkMapMutex.unlock();
m_renderer->PopMatrix();
}
示例4: Render
// Rendering
void ChunkManager::Render()
{
m_pRenderer->StartMeshRender();
// Store cull mode
CullMode cullMode = m_pRenderer->GetCullMode();
if (m_wireframeRender)
{
m_pRenderer->SetLineWidth(1.0f);
m_pRenderer->SetRenderMode(RM_WIREFRAME);
}
else
{
m_pRenderer->SetRenderMode(RM_SOLID);
}
m_pRenderer->PushMatrix();
m_ChunkMapMutexLock.lock();
typedef map<ChunkCoordKeys, Chunk*>::iterator it_type;
for (it_type iterator = m_chunksMap.begin(); iterator != m_chunksMap.end(); iterator++)
{
Chunk* pChunk = iterator->second;
if (pChunk != NULL && pChunk->IsCreated())
{
pChunk->Render();
}
}
m_ChunkMapMutexLock.unlock();
m_pRenderer->PopMatrix();
// Restore cull mode
m_pRenderer->SetCullMode(cullMode);
m_pRenderer->EndMeshRender();
}