- For hardware 2D, apply fixed colormaps when copying to video memory instead

of doing it directly during the rendering, in order to improve visual
  fidelity for colormaps that aren't grayscale.


SVN r1866 (trunk)
This commit is contained in:
Randy Heit 2009-09-22 04:21:27 +00:00
parent 84a018f05a
commit d502655866
6 changed files with 37 additions and 8 deletions

View file

@ -1,4 +1,7 @@
September 21, 2009
- For hardware 2D, apply fixed colormaps when copying to video memory instead
of doing it directly during the rendering, in order to improve visual
fidelity for colormaps that aren't grayscale.
- Added support for defining the full color range of a special colormap.
- Moved the code for specialcolormap and colormapstyle in D3DFB::SetStyle()
at the end of the normally-colored block so that they get all the proper

View file

@ -140,6 +140,7 @@ int validcount = 1; // increment every time a check is made
FDynamicColormap*basecolormap; // [RH] colormap currently drawing with
int fixedlightlev;
lighttable_t *fixedcolormap;
FSpecialColormap *realfixedcolormap;
float WallTMapScale;
float WallTMapScale2;
@ -1158,15 +1159,27 @@ void R_SetupFrame (AActor *actor)
}
}
realfixedcolormap = NULL;
fixedcolormap = NULL;
fixedlightlev = -1;
if (player != NULL && camera == player->mo)
{
if (player->fixedcolormap >= 0 && player->fixedcolormap < (int)SpecialColormaps.Size())
{
realfixedcolormap = &SpecialColormaps[player->fixedcolormap];
if (RenderTarget == screen && (DFrameBuffer *)screen->Accel2D)
{
// Render everything fullbright. The copy to video memory will
// apply the special colormap, so it won't be restricted to the
// palette.
fixedcolormap = realcolormaps;
}
else
{
fixedcolormap = SpecialColormaps[player->fixedcolormap].Colormap;
}
}
else if (player->fixedlightlevel >= 0 && player->fixedlightlevel < NUMCOLORMAPS)
{
fixedlightlev = player->fixedlightlevel * 256;

View file

@ -121,6 +121,7 @@ extern int extralight, r_actualextralight;
extern bool foggy;
extern int fixedlightlev;
extern lighttable_t* fixedcolormap;
extern FSpecialColormap*realfixedcolormap;
//

View file

@ -1648,9 +1648,9 @@ void R_DrawPSprite (pspdef_t* psp, int pspnum, AActor *owner, fixed_t sx, fixed_
}
}
if (fixedcolormap != NULL)
if (realfixedcolormap != NULL)
{ // fixed color
vis->colormap = fixedcolormap;
vis->colormap = realfixedcolormap->Colormap;
}
else
{

View file

@ -61,7 +61,7 @@
#include "v_pfx.h"
#include "stats.h"
#include "doomerrors.h"
#include "r_draw.h"
#include "r_main.h"
#include "r_translate.h"
#include "f_wipe.h"
#include "st_stuff.h"
@ -1074,21 +1074,32 @@ void D3DFB::Draw3DPart(bool copy3d)
SetTexture (0, FBTexture);
SetPaletteTexture(PaletteTexture, 256, BorderColor);
SetPixelShader(Shaders[SHADER_NormalColorPal]);
D3DDevice->SetFVF (D3DFVF_FBVERTEX);
memset(Constant, 0, sizeof(Constant));
SetAlphaBlend(D3DBLENDOP(0));
EnableAlphaTest(FALSE);
SetPixelShader(Shaders[SHADER_NormalColorPal]);
if (copy3d)
{
FBVERTEX verts[4];
D3DCOLOR color0, color1;
if (Accel2D)
{
if (realfixedcolormap == NULL)
{
color0 = 0;
color1 = 0xFFFFFFF;
}
else
{
color0 = D3DCOLOR_COLORVALUE(realfixedcolormap->ColorizeStart[0]/2,
realfixedcolormap->ColorizeStart[1]/2, realfixedcolormap->ColorizeStart[2]/2, 0);
color1 = D3DCOLOR_COLORVALUE(realfixedcolormap->ColorizeEnd[0]/2,
realfixedcolormap->ColorizeEnd[1]/2, realfixedcolormap->ColorizeEnd[2]/2, 1);
SetPixelShader(Shaders[SHADER_SpecialColormapPal]);
}
}
else
{
color0 = FlashColor0;
color1 = FlashColor1;
@ -1096,6 +1107,7 @@ void D3DFB::Draw3DPart(bool copy3d)
CalcFullscreenCoords(verts, Accel2D, false, color0, color1);
D3DDevice->DrawPrimitiveUP(D3DPT_TRIANGLEFAN, 2, verts, sizeof(FBVERTEX));
}
SetPixelShader(Shaders[SHADER_NormalColorPal]);
}
//==========================================================================

View file

@ -310,7 +310,7 @@ private:
SHADER_VertexColor,
SHADER_SpecialColormap,
SHADER_SpecialColorMapPal,
SHADER_SpecialColormapPal,
SHADER_InGameColormap,
SHADER_InGameColormapDesat,