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

View file

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

View file

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

View file

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