diff --git a/src/gl/renderer/gl_renderer.cpp b/src/gl/renderer/gl_renderer.cpp index c5b35d8e5..f4ae483c8 100644 --- a/src/gl/renderer/gl_renderer.cpp +++ b/src/gl/renderer/gl_renderer.cpp @@ -437,7 +437,6 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer) if (VRMode::GetVRMode(true)->mEyeCount == 1) mBuffers->BindCurrentFB(); - FDrawInfo di; // For access to the virtual interface. This should be placed elsewhere... const auto &mScreenViewport = screen->mScreenViewport; glViewport(mScreenViewport.left, mScreenViewport.top, mScreenViewport.width, mScreenViewport.height); screen->mViewpoints->Set2D(gl_RenderState, screen->GetWidth(), screen->GetHeight()); diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index c4744baed..f2d352c7d 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -497,28 +497,6 @@ void OpenGLFrameBuffer::PostProcessScene(int fixedcm, const std::functionPostProcessScene(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 @@ -533,7 +511,7 @@ FTexture *OpenGLFrameBuffer::WipeStartScreen() { const auto &viewport = screen->mScreenViewport; - FGLWipeTexture *tex = new FGLWipeTexture(viewport.width, viewport.height); + auto tex = new FWrapperTexture(viewport.width, viewport.height, 1); tex->SystemTexture[0]->CreateTexture(nullptr, viewport.width, viewport.height, 0, false, 0, "WipeStartScreen"); glFinish(); static_cast(tex->SystemTexture[0])->Bind(0, false, false); @@ -555,7 +533,7 @@ FTexture *OpenGLFrameBuffer::WipeEndScreen() { GLRenderer->Flush(); const auto &viewport = screen->mScreenViewport; - FGLWipeTexture *tex = new FGLWipeTexture(viewport.width, viewport.height); + auto tex = new FWrapperTexture(viewport.width, viewport.height, 1); tex->SystemTexture[0]->CreateTexture(NULL, viewport.width, viewport.height, 0, false, 0, "WipeEndScreen"); glFinish(); static_cast(tex->SystemTexture[0])->Bind(0, false, false); diff --git a/src/swrenderer/r_swscene.cpp b/src/swrenderer/r_swscene.cpp index 26b1e4060..f68336e85 100644 --- a/src/swrenderer/r_swscene.cpp +++ b/src/swrenderer/r_swscene.cpp @@ -61,22 +61,6 @@ public: } }; -class FSWSceneTexture : public FTexture -{ -public: - - FSWSceneTexture(int w, int h, int bits) - { - Width = w; - Height = h; - WidthBits = bits; - UseType = ETextureType::SWCanvas; - bNoCompress = true; - SystemTexture[0] = screen->CreateHardwareTexture(this); - } - - // This is just a wrapper around the hardware texture and should never call the bitmap getters - if it does, something is wrong. -}; //========================================================================== // @@ -106,7 +90,7 @@ sector_t *SWSceneDrawer::RenderView(player_t *player) { // This manually constructs its own material here. fbtex.reset(); - fbtex.reset(new FSWSceneTexture(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor())); + fbtex.reset(new FWrapperTexture(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor())); fbtex->SystemTexture[0]->AllocateBuffer(screen->GetWidth(), screen->GetHeight(), V_IsTrueColor() ? 4 : 1); auto mat = FMaterial::ValidateTexture(fbtex.get(), false); mat->AddTextureLayer(PaletteTexture.get()); diff --git a/src/swrenderer/r_swscene.h b/src/swrenderer/r_swscene.h index b57e3b947..9ed0bec03 100644 --- a/src/swrenderer/r_swscene.h +++ b/src/swrenderer/r_swscene.h @@ -8,12 +8,12 @@ #include "c_cvars.h" #include -class FSWSceneTexture; +class FWrapperTexture; class SWSceneDrawer { std::unique_ptr PaletteTexture; - std::unique_ptr FBTexture[2]; + std::unique_ptr FBTexture[2]; int FBTextureIndex = 0; bool FBIsTruecolor = false; std::unique_ptr Canvas; diff --git a/src/textures/formats/canvastexture.cpp b/src/textures/formats/canvastexture.cpp index 2cb8b807f..ae4a4697e 100644 --- a/src/textures/formats/canvastexture.cpp +++ b/src/textures/formats/canvastexture.cpp @@ -186,4 +186,3 @@ bool FCanvasTexture::CheckModified (FRenderStyle) } return false; } - diff --git a/src/textures/texture.cpp b/src/textures/texture.cpp index 88ae5b176..047a9b205 100644 --- a/src/textures/texture.cpp +++ b/src/textures/texture.cpp @@ -1489,6 +1489,23 @@ void FDummyTexture::SetSize (int width, int height) CalcBitSize (); } + +//========================================================================== +// +// +// +//========================================================================== + +FWrapperTexture::FWrapperTexture(int w, int h, int bits) +{ + Width = w; + Height = h; + WidthBits = bits; + UseType = ETextureType::SWCanvas; + bNoCompress = true; + SystemTexture[0] = screen->CreateHardwareTexture(this); +} + //========================================================================== // // Debug stuff diff --git a/src/textures/textures.h b/src/textures/textures.h index 89ce9d85b..924614876 100644 --- a/src/textures/textures.h +++ b/src/textures/textures.h @@ -789,6 +789,13 @@ public: friend struct FCanvasTextureInfo; }; +// A wrapper around a hardware texture, to allow using it in the 2D drawing interface. +class FWrapperTexture : public FTexture +{ +public: + FWrapperTexture(int w, int h, int bits = 1); +}; + extern FTextureManager TexMan; #endif