mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-11 15:22:15 +00:00
- merged the nearly identical wrapper texture classes for the software render and the wiper.
This commit is contained in:
parent
6dc47ff328
commit
98e111eba0
7 changed files with 29 additions and 45 deletions
|
@ -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());
|
||||
|
|
|
@ -497,28 +497,6 @@ 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
|
||||
|
@ -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<FHardwareTexture*>(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<FHardwareTexture*>(tex->SystemTexture[0])->Bind(0, false, false);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
#include "c_cvars.h"
|
||||
#include <memory>
|
||||
|
||||
class FSWSceneTexture;
|
||||
class FWrapperTexture;
|
||||
|
||||
class SWSceneDrawer
|
||||
{
|
||||
std::unique_ptr<FTexture> PaletteTexture;
|
||||
std::unique_ptr<FSWSceneTexture> FBTexture[2];
|
||||
std::unique_ptr<FWrapperTexture> FBTexture[2];
|
||||
int FBTextureIndex = 0;
|
||||
bool FBIsTruecolor = false;
|
||||
std::unique_ptr<DSimpleCanvas> Canvas;
|
||||
|
|
|
@ -186,4 +186,3 @@ bool FCanvasTexture::CheckModified (FRenderStyle)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue