示例#1
0
文件: main.cpp 项目: tim37021/R3D2
static RenderTarget *BuildGBuffer(Device *device, Vector2i size)
{
    RenderTarget *rt = device->addRenderTarget();
    TextureManager *tm = device->getTextureManager();
    std::vector<Texture *> textures = {tm->registerTexture("GBUFFER_COLOR")};
    for(auto texture: textures)
        texture->create(size, PixelFormat::PF_R8G8B8A8);
    rt->attachTextures(textures);
    Texture *depth_texture = tm->registerTexture("GBUFFER_DEPTH");
    depth_texture->create(size, PixelFormat::PF_D24);
    rt->attachDepthTexture(depth_texture);

    return rt;
}