mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 07:11:54 +00:00
- made DTA_SpecialColormap work, both for GL3+ and GL2 render paths.
This will only be used for HUD sprites. At the moment it will ignore sprite translations, though, when running in OpenGL 2 legacy mode.
This commit is contained in:
parent
832df6d43a
commit
00c66f42d3
3 changed files with 18 additions and 9 deletions
|
@ -14,6 +14,7 @@ enum EColorManipulation
|
||||||
CM_INVALID=-1,
|
CM_INVALID=-1,
|
||||||
CM_DEFAULT=0, // untranslated
|
CM_DEFAULT=0, // untranslated
|
||||||
CM_FIRSTSPECIALCOLORMAP, // first special fixed colormap
|
CM_FIRSTSPECIALCOLORMAP, // first special fixed colormap
|
||||||
|
CM_FIRSTSPECIALCOLORMAPFORCED= 0x08000000, // first special fixed colormap, application forced (for 2D overlays)
|
||||||
|
|
||||||
CM_FOGLAYER = 0x10000000, // Sprite shaped fog layer
|
CM_FOGLAYER = 0x10000000, // Sprite shaped fog layer
|
||||||
|
|
||||||
|
@ -23,6 +24,7 @@ enum EColorManipulation
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CM_MAXCOLORMAP int(CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size())
|
#define CM_MAXCOLORMAP int(CM_FIRSTSPECIALCOLORMAP + SpecialColormaps.Size())
|
||||||
|
#define CM_MAXCOLORMAPFORCED int(CM_FIRSTSPECIALCOLORMAPFORCED + SpecialColormaps.Size())
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -546,7 +546,7 @@ void FGLRenderer::Draw2D(F2DDrawer *drawer)
|
||||||
if (index < 0 || (unsigned)index >= SpecialColormaps.Size()) index = 0; // if it isn't in the table FBitmap cannot use it. Shouldn't happen anyway.
|
if (index < 0 || (unsigned)index >= SpecialColormaps.Size()) index = 0; // if it isn't in the table FBitmap cannot use it. Shouldn't happen anyway.
|
||||||
if (!gl.legacyMode)
|
if (!gl.legacyMode)
|
||||||
{
|
{
|
||||||
gl_RenderState.SetFixedColormap(CM_FIRSTSPECIALCOLORMAP + int(index));
|
gl_RenderState.SetFixedColormap(CM_FIRSTSPECIALCOLORMAPFORCED + int(index));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -253,9 +253,9 @@ bool FRenderState::ApplyShader()
|
||||||
{
|
{
|
||||||
activeShader->muFixedColormap.Set(0);
|
activeShader->muFixedColormap.Set(0);
|
||||||
}
|
}
|
||||||
else if (mColormapState > CM_DEFAULT && mColormapState < CM_MAXCOLORMAP)
|
else if ((mColormapState >= CM_FIRSTSPECIALCOLORMAP && mColormapState < CM_MAXCOLORMAPFORCED))
|
||||||
{
|
{
|
||||||
if (FGLRenderBuffers::IsEnabled())
|
if (FGLRenderBuffers::IsEnabled() && mColormapState < CM_FIRSTSPECIALCOLORMAPFORCED)
|
||||||
{
|
{
|
||||||
// When using postprocessing to apply the colormap, we must render the image fullbright here.
|
// When using postprocessing to apply the colormap, we must render the image fullbright here.
|
||||||
activeShader->muFixedColormap.Set(2);
|
activeShader->muFixedColormap.Set(2);
|
||||||
|
@ -263,7 +263,12 @@ bool FRenderState::ApplyShader()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FSpecialColormap *scm = &SpecialColormaps[mColormapState - CM_FIRSTSPECIALCOLORMAP];
|
if (mColormapState >= CM_FIRSTSPECIALCOLORMAPFORCED)
|
||||||
|
{
|
||||||
|
auto colormapState = mColormapState + CM_FIRSTSPECIALCOLORMAP - CM_FIRSTSPECIALCOLORMAPFORCED;
|
||||||
|
if (colormapState < CM_MAXCOLORMAP)
|
||||||
|
{
|
||||||
|
FSpecialColormap *scm = &SpecialColormaps[colormapState - CM_FIRSTSPECIALCOLORMAP];
|
||||||
float m[] = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
|
float m[] = { scm->ColorizeEnd[0] - scm->ColorizeStart[0],
|
||||||
scm->ColorizeEnd[1] - scm->ColorizeStart[1], scm->ColorizeEnd[2] - scm->ColorizeStart[2], 0.f };
|
scm->ColorizeEnd[1] - scm->ColorizeStart[1], scm->ColorizeEnd[2] - scm->ColorizeStart[2], 0.f };
|
||||||
|
|
||||||
|
@ -272,6 +277,8 @@ bool FRenderState::ApplyShader()
|
||||||
activeShader->muColormapRange.Set(m);
|
activeShader->muColormapRange.Set(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (mColormapState == CM_FOGLAYER)
|
else if (mColormapState == CM_FOGLAYER)
|
||||||
{
|
{
|
||||||
activeShader->muFixedColormap.Set(3);
|
activeShader->muFixedColormap.Set(3);
|
||||||
|
|
Loading…
Reference in a new issue