- moved the two remaining functions from gl_wipe.cpp to gl_framebuffer.cpp and deleted the file.

The single most hideous thing in the GL renderer is finally gone. :)
This commit is contained in:
Christoph Oelckers 2018-08-28 23:36:13 +02:00
commit bec588eaf4
3 changed files with 68 additions and 105 deletions

View file

@ -483,3 +483,71 @@ void OpenGLFrameBuffer::PostProcessScene(int fixedcm, const std::function<void()
{
GLRenderer->PostProcessScene(fixedcm, afterBloomDrawEndScene2D);
}
//==========================================================================
//
// This is just a wrapper around the hardware texture being extracted below so that it can be passed to the 2D code.
//
//==========================================================================
class FGLWipeTexture : public FTexture
{
public:
FGLWipeTexture(int w, int h)
{
Width = w;
Height = h;
WidthBits = 4;
UseType = ETextureType::SWCanvas;
bNoCompress = true;
SystemTexture[0] = screen->CreateHardwareTexture(this);
}
};
//==========================================================================
//
// OpenGLFrameBuffer :: WipeStartScreen
//
// Called before the current screen has started rendering. This needs to
// save what was drawn the previous frame so that it can be animated into
// what gets drawn this frame.
//
//==========================================================================
FTexture *OpenGLFrameBuffer::WipeStartScreen()
{
const auto &viewport = screen->mScreenViewport;
FGLWipeTexture *tex = new FGLWipeTexture(viewport.width, viewport.height);
tex->SystemTexture[0]->CreateTexture(nullptr, viewport.width, viewport.height, 0, false, 0, "WipeStartScreen");
glFinish();
static_cast<FHardwareTexture*>(tex->SystemTexture[0])->Bind(0, false, false);
GLRenderer->mBuffers->BindCurrentFB();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, viewport.left, viewport.top, viewport.width, viewport.height);
return tex;
}
//==========================================================================
//
// OpenGLFrameBuffer :: WipeEndScreen
//
// The screen we want to animate to has just been drawn.
//
//==========================================================================
FTexture *OpenGLFrameBuffer::WipeEndScreen()
{
GLRenderer->Flush();
const auto &viewport = screen->mScreenViewport;
FGLWipeTexture *tex = new FGLWipeTexture(viewport.width, viewport.height);
tex->SystemTexture[0]->CreateTexture(NULL, viewport.width, viewport.height, 0, false, 0, "WipeEndScreen");
glFinish();
static_cast<FHardwareTexture*>(tex->SystemTexture[0])->Bind(0, false, false);
GLRenderer->mBuffers->BindCurrentFB();
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, viewport.left, viewport.top, viewport.width, viewport.height);
return tex;
}