- fix for rendering a brightmapped 2D texture with ColorIsFixed render style.

This must disable the brightmap.
This commit is contained in:
Christoph Oelckers 2018-04-30 21:28:06 +02:00
parent 1baf3ccbf6
commit 2b5019ea6e
3 changed files with 20 additions and 0 deletions

View file

@ -767,6 +767,7 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer)
gl_GetRenderStyle(cmd.mRenderStyle, false, false, &tm, &sb, &db, &be); gl_GetRenderStyle(cmd.mRenderStyle, false, false, &tm, &sb, &db, &be);
gl_RenderState.BlendEquation(be); gl_RenderState.BlendEquation(be);
gl_RenderState.BlendFunc(sb, db); gl_RenderState.BlendFunc(sb, db);
gl_RenderState.EnableBrightmap(!(cmd.mRenderStyle.Flags & STYLEF_ColorIsFixed));
// Rather than adding remapping code, let's enforce that the constants here are equal. // Rather than adding remapping code, let's enforce that the constants here are equal.
static_assert(int(F2DDrawer::DTM_Normal) == int(TM_MODULATE), "DTM_Normal != TM_MODULATE"); static_assert(int(F2DDrawer::DTM_Normal) == int(TM_MODULATE), "DTM_Normal != TM_MODULATE");
@ -878,6 +879,7 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer)
gl_RenderState.SetVertexBuffer(GLRenderer->mVBO); gl_RenderState.SetVertexBuffer(GLRenderer->mVBO);
gl_RenderState.EnableTexture(true); gl_RenderState.EnableTexture(true);
gl_RenderState.EnableBrightmap(true);
gl_RenderState.SetTextureMode(TM_MODULATE); gl_RenderState.SetTextureMode(TM_MODULATE);
gl_RenderState.SetFixedColormap(CM_DEFAULT); gl_RenderState.SetFixedColormap(CM_DEFAULT);
gl_RenderState.ResetColor(); gl_RenderState.ResetColor();

View file

@ -212,6 +212,22 @@ WeaponLighting GetWeaponLighting(sector_t *viewsector, const DVector3 &pos, int
return l; return l;
} }
void WeaponLighting::SetBright()
{
if (!isbelow)
{
cm.MakeWhite();
}
else
{
// under water areas keep most of their color for fullbright objects
cm.LightColor.r = (3 * cm.LightColor.r + 0xff) / 4;
cm.LightColor.g = (3 * cm.LightColor.g + 0xff) / 4;
cm.LightColor.b = (3 * cm.LightColor.b + 0xff) / 4;
}
lightlevel = 255;
}
//========================================================================== //==========================================================================
// //
// Render Style // Render Style

View file

@ -19,6 +19,8 @@ struct WeaponLighting
FColormap cm; FColormap cm;
int lightlevel; int lightlevel;
bool isbelow; bool isbelow;
void SetBright();
}; };
struct WeaponRenderStyle struct WeaponRenderStyle