当前位置: 首页>>代码示例>>C++>>正文


C++ Chunk::Render方法代码示例

本文整理汇总了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();
        }
    }
}
开发者ID:SamuelBoerlin,项目名称:Marching-Cubes,代码行数:8,代码来源:world.cpp

示例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();
}
开发者ID:Digmaster,项目名称:Vox,代码行数:53,代码来源:ChunkManager.cpp

示例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();
}
开发者ID:ggtucker,项目名称:SugoiEngine,代码行数:22,代码来源:ChunkManager.cpp

示例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();
}
开发者ID:CodeMason,项目名称:Vox,代码行数:38,代码来源:ChunkManager.cpp


注:本文中的Chunk::Render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。