- 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; SWSceneDrawer *swdrawer = nullptr;
float mSceneClearColor[3];
FGLRenderer(OpenGLFrameBuffer *fb); FGLRenderer(OpenGLFrameBuffer *fb);
~FGLRenderer() ; ~FGLRenderer() ;

View file

@ -223,7 +223,7 @@ void FGLRenderer::Set3DViewport()
// This is faster on newer hardware because it allows the GPU to skip // This is faster on newer hardware because it allows the GPU to skip
// reading from slower memory where the full buffers are stored. // reading from slower memory where the full buffers are stored.
glDisable(GL_SCISSOR_TEST); 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); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
const auto &bounds = screen->mSceneViewport; const auto &bounds = screen->mSceneViewport;

View file

@ -131,8 +131,6 @@ void OpenGLFrameBuffer::InitializeState()
gl_PrintStartupLog(); gl_PrintStartupLog();
} }
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0f);
glDepthFunc(GL_LESS); glDepthFunc(GL_LESS);
glEnable(GL_DITHER); glEnable(GL_DITHER);
@ -145,6 +143,8 @@ void OpenGLFrameBuffer::InitializeState()
glDisable(GL_LINE_SMOOTH); glDisable(GL_LINE_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 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); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
SetViewportRects(nullptr); 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() void OpenGLFrameBuffer::BeginFrame()
{ {
SetViewportRects(nullptr); SetViewportRects(nullptr);

View file

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