- Implementing RGB666 colormatching to replace less precise RGB555 in some parts of the code.

This commit is contained in:
Rachael Alexanderson 2016-12-17 04:11:52 -05:00
commit 821b10a254
18 changed files with 368 additions and 627 deletions

View file

@ -2636,12 +2636,12 @@ static void R_DrawMaskedSegsBehindParticle (const vissprite_t *vis)
}
}
void R_DrawParticle_C (vissprite_t *vis)
//inline int clamp(int x, int y, int z) { return ((x < y) ? x : (z < y) ? z : y); }
void R_DrawParticle (vissprite_t *vis)
{
DWORD *bg2rgb;
int spacing;
BYTE *dest;
DWORD fg;
BYTE color = vis->Style.colormap[vis->startfrac];
int yl = vis->y1;
int ycount = vis->y2 - yl + 1;
@ -2653,33 +2653,10 @@ void R_DrawParticle_C (vissprite_t *vis)
DrawerCommandQueue::WaitForWorkers();
// vis->renderflags holds translucency level (0-255)
{
fixed_t fglevel, bglevel;
DWORD *fg2rgb;
fixed_t fglevel, bglevel;
fglevel = ((vis->renderflags + 1) << 8) & ~0x3ff;
bglevel = FRACUNIT-fglevel;
fg2rgb = Col2RGB8[fglevel>>10];
bg2rgb = Col2RGB8[bglevel>>10];
fg = fg2rgb[color];
}
/*
spacing = RenderTarget->GetPitch() - countbase;
dest = ylookup[yl] + x1 + dc_destorg;
do
{
int count = countbase;
do
{
DWORD bg = bg2rgb[*dest];
bg = (fg+bg) | 0x1f07c1f;
*dest++ = RGB32k.All[bg & (bg>>15)];
} while (--count);
dest += spacing;
} while (--ycount);*/
fglevel = ((vis->renderflags + 1) << 8) & ~0x3ff;
bglevel = FRACUNIT-fglevel;
// original was row-wise
// width = countbase
@ -2695,9 +2672,11 @@ void R_DrawParticle_C (vissprite_t *vis)
dest = ylookup[yl] + x + dc_destorg;
for (int y = 0; y < ycount; y++)
{
DWORD bg = bg2rgb[*dest];
bg = (fg+bg) | 0x1f07c1f;
*dest = RGB32k.All[bg & (bg>>15)];
uint32_t dest_r = MIN((GPalette.BaseColors[*dest].r * bglevel + GPalette.BaseColors[color].r * fglevel) >> 18, 63);
uint32_t dest_g = MIN((GPalette.BaseColors[*dest].g * bglevel + GPalette.BaseColors[color].g * fglevel) >> 18, 63);
uint32_t dest_b = MIN((GPalette.BaseColors[*dest].b * bglevel + GPalette.BaseColors[color].b * fglevel) >> 18, 63);
*dest = RGB256k.RGB[dest_r][dest_g][dest_b];
dest += spacing;
}
}