- moved the mSceneClearColor variable to main DFrameBuffer class.

This commit is contained in:
Christoph Oelckers 2018-10-29 09:34:30 +01:00
parent 98e111eba0
commit 90982285ac
6 changed files with 14 additions and 16 deletions

View file

@ -70,8 +70,6 @@ public:
SWSceneDrawer *swdrawer = nullptr;
float mSceneClearColor[3];
FGLRenderer(OpenGLFrameBuffer *fb);
~FGLRenderer() ;

View file

@ -223,7 +223,7 @@ void FGLRenderer::Set3DViewport()
// This is faster on newer hardware because it allows the GPU to skip
// reading from slower memory where the full buffers are stored.
glDisable(GL_SCISSOR_TEST);
glClearColor(mSceneClearColor[0], mSceneClearColor[1], mSceneClearColor[2], 1.0f);
glClearColor(screen->mSceneClearColor[0], screen->mSceneClearColor[1], screen->mSceneClearColor[2], screen->mSceneClearColor[3]);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
const auto &bounds = screen->mSceneViewport;

View file

@ -131,8 +131,6 @@ void OpenGLFrameBuffer::InitializeState()
gl_PrintStartupLog();
}
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0f);
glDepthFunc(GL_LESS);
glEnable(GL_DITHER);
@ -145,6 +143,8 @@ void OpenGLFrameBuffer::InitializeState()
glDisable(GL_LINE_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
SetViewportRects(nullptr);
@ -415,15 +415,6 @@ void OpenGLFrameBuffer::UpdatePalette()
//
//===========================================================================
void OpenGLFrameBuffer::SetClearColor(int color)
{
PalEntry pe = GPalette.BaseColors[color];
GLRenderer->mSceneClearColor[0] = pe.r / 255.f;
GLRenderer->mSceneClearColor[1] = pe.g / 255.f;
GLRenderer->mSceneClearColor[2] = pe.b / 255.f;
}
void OpenGLFrameBuffer::BeginFrame()
{
SetViewportRects(nullptr);

View file

@ -27,7 +27,6 @@ public:
void CleanForRestart() override;
void UpdatePalette() override;
void SetClearColor(int color) override;
uint32_t GetCaps() override;
void RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV) override;
void WriteSavePic(player_t *player, FileWriter *file, int width, int height) override;

View file

@ -324,6 +324,14 @@ void DFrameBuffer::GetFlash(PalEntry &rgb, int &amount)
amount = Flash.a;
}
void DFrameBuffer::SetClearColor(int color)
{
PalEntry pe = GPalette.BaseColors[color];
mSceneClearColor[0] = pe.r / 255.f;
mSceneClearColor[1] = pe.g / 255.f;
mSceneClearColor[2] = pe.b / 255.f;
mSceneClearColor[3] = 1.f;
}
//==========================================================================
//

View file

@ -389,6 +389,8 @@ public:
IntRect mScreenViewport;
IntRect mSceneViewport;
IntRect mOutputLetterbox;
float mSceneClearColor[4];
public:
DFrameBuffer (int width=1, int height=1);
@ -493,7 +495,7 @@ public:
// Report a game restart
void InitPalette();
virtual void SetClearColor(int color) {}
void SetClearColor(int color);
virtual uint32_t GetCaps();
virtual void RenderTextureView(FCanvasTexture *tex, AActor *Viewpoint, double FOV);
virtual void WriteSavePic(player_t *player, FileWriter *file, int width, int height);