Fix tonemap palette not being rebuilt on palette change

This commit is contained in:
Magnus Norddahl 2016-08-25 19:58:50 +02:00 committed by Christoph Oelckers
parent c9578ae72d
commit b1a0108a96
4 changed files with 11 additions and 0 deletions

View File

@ -278,6 +278,12 @@ void FGLRenderer::BindTonemapPalette(int texunit)
} }
} }
void FGLRenderer::ClearTonemapPalette()
{
delete mTonemapPalette;
mTonemapPalette = nullptr;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// //
// Apply lens distortion and place the result in the HUD/2D texture // Apply lens distortion and place the result in the HUD/2D texture

View File

@ -111,6 +111,7 @@ FGLRenderer::FGLRenderer(OpenGLFrameBuffer *fb)
gllight = glpart2 = glpart = mirrortexture = NULL; gllight = glpart2 = glpart = mirrortexture = NULL;
mLights = NULL; mLights = NULL;
m2DDrawer = nullptr; m2DDrawer = nullptr;
mTonemapPalette = nullptr;
} }
void gl_LoadModels(); void gl_LoadModels();

View File

@ -167,6 +167,7 @@ public:
void BloomScene(); void BloomScene();
void TonemapScene(); void TonemapScene();
void BindTonemapPalette(int texunit); void BindTonemapPalette(int texunit);
void ClearTonemapPalette();
void LensDistortScene(); void LensDistortScene();
void CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma); void CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma);
void Flush() { CopyToBackbuffer(nullptr, true); } void Flush() { CopyToBackbuffer(nullptr, true); }

View File

@ -310,6 +310,9 @@ void OpenGLFrameBuffer::UpdatePalette()
bb>>=8; bb>>=8;
palette_brightness = (rr*77 + gg*143 + bb*35)/255; palette_brightness = (rr*77 + gg*143 + bb*35)/255;
if (GLRenderer)
GLRenderer->ClearTonemapPalette();
} }
void OpenGLFrameBuffer::GetFlashedPalette (PalEntry pal[256]) void OpenGLFrameBuffer::GetFlashedPalette (PalEntry pal[256])