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


C++ Compositor::blit方法代码示例

本文整理汇总了C++中Compositor::blit方法的典型用法代码示例。如果您正苦于以下问题:C++ Compositor::blit方法的具体用法?C++ Compositor::blit怎么用?C++ Compositor::blit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Compositor的用法示例。


在下文中一共展示了Compositor::blit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: render

void PostProcessSample::render(float elapsedTime)
{
    Rectangle defaultViewport = Game::getInstance()->getViewport();
    
    // Draw into the framebuffer
    Game::getInstance()->setViewport(Rectangle(FRAMEBUFFER_WIDTH, FRAMEBUFFER_HEIGHT));
    FrameBuffer* previousFrameBuffer = _frameBuffer->bind();
    clear(CLEAR_COLOR_DEPTH, Vector4::zero(), 1.0f, 0);
    _scene->visit(this, &PostProcessSample::drawScene);

    // Bind the current compositor
    Game::getInstance()->setViewport(defaultViewport);
    Compositor* compositor = _compositors[_compositorIndex];

    FrameBuffer* compositorDstFrameBuffer = compositor->getDstFrameBuffer();
    FrameBuffer* prevToCompositeFrameBuffer = NULL;
    if (compositorDstFrameBuffer)
    {
        prevToCompositeFrameBuffer = compositorDstFrameBuffer->bind();
    }
    else
    {
        prevToCompositeFrameBuffer = previousFrameBuffer->bind();
    }

    Game::getInstance()->clear(CLEAR_COLOR, Vector4(0, 0, 0, 1), 1.0f, 0);
    compositor->blit(defaultViewport);
    drawFrameRate(_font, Vector4(0, 0.5f, 1, 1), 5, 1, getFrameRate());
    drawTechniqueId(compositor->getTechniqueId());

    previousFrameBuffer->bind();

    // Draw the pass through compositor at index 0 at quarter of the size and bottom right. dont clear the dest just draw last on top
    float quarterWidth = getWidth() / 4;
    float quarterHeight = getHeight() / 4;
    Rectangle offsetViewport = Rectangle(getWidth() - quarterWidth, 0, quarterWidth, quarterHeight);
    Game::getInstance()->setViewport(offsetViewport);
    compositor = _compositors[0];
    compositor->blit(offsetViewport);
    Game::getInstance()->setViewport(defaultViewport);

}
开发者ID:,项目名称:,代码行数:42,代码来源:


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