mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- 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:
parent
84a018f05a
commit
d502655866
6 changed files with 37 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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,6 +1159,7 @@ void R_SetupFrame (AActor *actor)
|
|||
}
|
||||
}
|
||||
|
||||
realfixedcolormap = NULL;
|
||||
fixedcolormap = NULL;
|
||||
fixedlightlev = -1;
|
||||
|
||||
|
@ -1165,7 +1167,18 @@ void R_SetupFrame (AActor *actor)
|
|||
{
|
||||
if (player->fixedcolormap >= 0 && player->fixedcolormap < (int)SpecialColormaps.Size())
|
||||
{
|
||||
fixedcolormap = SpecialColormaps[player->fixedcolormap].Colormap;
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -121,6 +121,7 @@ extern int extralight, r_actualextralight;
|
|||
extern bool foggy;
|
||||
extern int fixedlightlev;
|
||||
extern lighttable_t* fixedcolormap;
|
||||
extern FSpecialColormap*realfixedcolormap;
|
||||
|
||||
|
||||
//
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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,19 +1074,30 @@ 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)
|
||||
{
|
||||
color0 = 0;
|
||||
color1 = 0xFFFFFFF;
|
||||
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
|
||||
{
|
||||
|
@ -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]);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -310,7 +310,7 @@ private:
|
|||
SHADER_VertexColor,
|
||||
|
||||
SHADER_SpecialColormap,
|
||||
SHADER_SpecialColorMapPal,
|
||||
SHADER_SpecialColormapPal,
|
||||
|
||||
SHADER_InGameColormap,
|
||||
SHADER_InGameColormapDesat,
|
||||
|
|
Loading…
Reference in a new issue