mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 15:32:57 +00:00
- Yeah, it's time to take a break. Have fun with this! :D
This commit is contained in:
parent
2ba402dc74
commit
179c7dba83
4 changed files with 47 additions and 154 deletions
|
@ -320,9 +320,9 @@ namespace swrenderer
|
|||
fg = (fg + bg) | 0x1f07c1f;
|
||||
*dest = RGB32k.All[fg & (fg >> 15)];
|
||||
#else
|
||||
uint32_t r = clamp(GPalette.BaseColors[colormap[pix]].r + GPalette.BaseColors[*dest].r, 0, 255);
|
||||
uint32_t g = clamp(GPalette.BaseColors[colormap[pix]].g + GPalette.BaseColors[*dest].g, 0, 255);
|
||||
uint32_t b = clamp(GPalette.BaseColors[colormap[pix]].b + GPalette.BaseColors[*dest].b, 0, 255);
|
||||
uint32_t r = MIN(GPalette.BaseColors[colormap[pix]].r + GPalette.BaseColors[*dest].r, 255);
|
||||
uint32_t g = MIN(GPalette.BaseColors[colormap[pix]].g + GPalette.BaseColors[*dest].g, 255);
|
||||
uint32_t b = MIN(GPalette.BaseColors[colormap[pix]].b + GPalette.BaseColors[*dest].b, 255);
|
||||
*dest = RGB256k.RGB[r>>2][g>>2][b>>2];
|
||||
#endif
|
||||
}
|
||||
|
@ -370,9 +370,9 @@ namespace swrenderer
|
|||
fg = (fg + bg) | 0x1f07c1f;
|
||||
dest[i] = RGB32k.All[fg & (fg >> 15)];
|
||||
#else
|
||||
uint32_t r = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].r + GPalette.BaseColors[dest[i]].r, 0, 255);
|
||||
uint32_t g = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].g + GPalette.BaseColors[dest[i]].g, 0, 255);
|
||||
uint32_t b = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].b + GPalette.BaseColors[dest[i]].b, 0, 255);
|
||||
uint32_t r = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].r + GPalette.BaseColors[dest[i]].r, 255);
|
||||
uint32_t g = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].g + GPalette.BaseColors[dest[i]].g, 255);
|
||||
uint32_t b = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].b + GPalette.BaseColors[dest[i]].b, 255);
|
||||
dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2];
|
||||
#endif
|
||||
}
|
||||
|
@ -410,22 +410,10 @@ namespace swrenderer
|
|||
uint8_t pix = source[frac >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
uint32_t a = fg2rgb[colormap[pix]] + bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
#else
|
||||
uint32_t r = clamp(GPalette.BaseColors[colormap[pix]].r + GPalette.BaseColors[*dest].r, 0, 255);
|
||||
uint32_t g = clamp(GPalette.BaseColors[colormap[pix]].g + GPalette.BaseColors[*dest].g, 0, 255);
|
||||
uint32_t b = clamp(GPalette.BaseColors[colormap[pix]].b + GPalette.BaseColors[*dest].b, 0, 255);
|
||||
uint32_t r = MIN(GPalette.BaseColors[colormap[pix]].r + GPalette.BaseColors[*dest].r, 255);
|
||||
uint32_t g = MIN(GPalette.BaseColors[colormap[pix]].g + GPalette.BaseColors[*dest].g, 255);
|
||||
uint32_t b = MIN(GPalette.BaseColors[colormap[pix]].b + GPalette.BaseColors[*dest].b, 255);
|
||||
*dest = RGB256k.RGB[r>>2][g>>2][b>>2];
|
||||
#endif
|
||||
}
|
||||
frac += fracstep;
|
||||
dest += pitch;
|
||||
|
@ -465,22 +453,10 @@ namespace swrenderer
|
|||
uint8_t pix = _bufplce[i][vplce[i] >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
uint32_t a = fg2rgb[_palookupoffse[i][pix]] + bg2rgb[dest[i]];
|
||||
uint32_t b = a;
|
||||
|
||||
a |= 0x01f07c1f;
|
||||
b &= 0x40100400;
|
||||
a &= 0x3fffffff;
|
||||
b = b - (b >> 5);
|
||||
a |= b;
|
||||
dest[i] = RGB32k.All[a & (a >> 15)];
|
||||
#else
|
||||
uint32_t r = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].r + GPalette.BaseColors[dest[i]].r, 0, 255);
|
||||
uint32_t g = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].g + GPalette.BaseColors[dest[i]].g, 0, 255);
|
||||
uint32_t b = clamp(GPalette.BaseColors[_palookupoffse[i][pix]].b + GPalette.BaseColors[dest[i]].b, 0, 255);
|
||||
uint32_t r = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].r + GPalette.BaseColors[dest[i]].r, 255);
|
||||
uint32_t g = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].g + GPalette.BaseColors[dest[i]].g, 255);
|
||||
uint32_t b = MIN(GPalette.BaseColors[_palookupoffse[i][pix]].b + GPalette.BaseColors[dest[i]].b, 255);
|
||||
dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2];
|
||||
#endif
|
||||
}
|
||||
vplce[i] += vince[i];
|
||||
}
|
||||
|
@ -516,21 +492,10 @@ namespace swrenderer
|
|||
uint8_t pix = source[frac >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
uint32_t a = (fg2rgb[colormap[pix]] | 0x40100400) - bg2rgb[*dest];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
#else
|
||||
uint32_t r = clamp(-GPalette.BaseColors[colormap[pix]].r + GPalette.BaseColors[*dest].r, 0, 255);
|
||||
uint32_t g = clamp(-GPalette.BaseColors[colormap[pix]].g + GPalette.BaseColors[*dest].g, 0, 255);
|
||||
uint32_t b = clamp(-GPalette.BaseColors[colormap[pix]].b + GPalette.BaseColors[*dest].b, 0, 255);
|
||||
int r = clamp(-GPalette.BaseColors[colormap[pix]].r + GPalette.BaseColors[*dest].r, 0, 255);
|
||||
int g = clamp(-GPalette.BaseColors[colormap[pix]].g + GPalette.BaseColors[*dest].g, 0, 255);
|
||||
int b = clamp(-GPalette.BaseColors[colormap[pix]].b + GPalette.BaseColors[*dest].b, 0, 255);
|
||||
*dest = RGB256k.RGB[r>>2][g>>2][b>>2];
|
||||
#endif
|
||||
}
|
||||
frac += fracstep;
|
||||
dest += pitch;
|
||||
|
@ -570,21 +535,10 @@ namespace swrenderer
|
|||
uint8_t pix = _bufplce[i][vplce[i] >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
uint32_t a = (fg2rgb[_palookupoffse[i][pix]] | 0x40100400) - bg2rgb[dest[i]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
dest[i] = RGB32k.All[a & (a >> 15)];
|
||||
#else
|
||||
uint32_t r = clamp(-GPalette.BaseColors[_palookupoffse[i][pix]].r + GPalette.BaseColors[dest[i]].r, 0, 255);
|
||||
uint32_t g = clamp(-GPalette.BaseColors[_palookupoffse[i][pix]].g + GPalette.BaseColors[dest[i]].g, 0, 255);
|
||||
uint32_t b = clamp(-GPalette.BaseColors[_palookupoffse[i][pix]].b + GPalette.BaseColors[dest[i]].b, 0, 255);
|
||||
int r = clamp(-GPalette.BaseColors[_palookupoffse[i][pix]].r + GPalette.BaseColors[dest[i]].r, 0, 255);
|
||||
int g = clamp(-GPalette.BaseColors[_palookupoffse[i][pix]].g + GPalette.BaseColors[dest[i]].g, 0, 255);
|
||||
int b = clamp(-GPalette.BaseColors[_palookupoffse[i][pix]].b + GPalette.BaseColors[dest[i]].b, 0, 255);
|
||||
dest[i] = RGB256k.RGB[r>>2][g>>2][b>>2];
|
||||
#endif
|
||||
}
|
||||
vplce[i] += vince[i];
|
||||
}
|
||||
|
@ -620,21 +574,10 @@ namespace swrenderer
|
|||
uint8_t pix = source[frac >> bits];
|
||||
if (pix != 0)
|
||||
{
|
||||
#ifdef NO_RGB666
|
||||
uint32_t a = (bg2rgb[*dest] | 0x40100400) - fg2rgb[colormap[pix]];
|
||||
uint32_t b = a;
|
||||
|
||||
b &= 0x40100400;
|
||||
b = b - (b >> 5);
|
||||
a &= b;
|
||||
a |= 0x01f07c1f;
|
||||
*dest = RGB32k.All[a & (a >> 15)];
|
||||
#else
|
||||
uint32_t r = clamp(GPalette.BaseColors[colormap[pix]].r - GPalette.BaseColors[*dest].r, 0, 255);
|
||||
uint32_t g = clamp(GPalette.BaseColors[colormap[pix]].g - GPalette.BaseColors[*dest].g, 0, 255);
|
||||
uint32_t b = clamp(GPalette.BaseColors[colormap[pix]].b - GPalette.BaseColors[*dest].b, 0, 255);
|
||||
int r = clamp(GPalette.BaseColors[colormap[pix]].r - GPalette.BaseColors[*dest].r, 0, 255);
|
||||
int g = clamp(GPalette.BaseColors[colormap[pix]].g - GPalette.BaseColors[*dest].g, 0, 255);
|
||||
int b = clamp(GPalette.BaseColors[colormap[pix]].b - GPalette.BaseColors[*dest].b, 0, 255);
|
||||
*dest = RGB256k.RGB[r>>2][g>>2][b>>2];
|
||||
#endif
|
||||
}
|
||||
frac += fracstep;
|
||||
dest += pitch;
|
||||
|
|
|
@ -2634,10 +2634,8 @@ static void R_DrawMaskedSegsBehindParticle (const vissprite_t *vis)
|
|||
|
||||
void R_DrawParticle_C (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;
|
||||
|
@ -2649,33 +2647,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
|
||||
|
@ -2691,9 +2666,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)];
|
||||
int dest_r = (GPalette.BaseColors[*dest].r * bglevel + GPalette.BaseColors[color].r * fglevel) >> 10;
|
||||
int dest_g = (GPalette.BaseColors[*dest].g * bglevel + GPalette.BaseColors[color].g * fglevel) >> 10;
|
||||
int dest_b = (GPalette.BaseColors[*dest].b * bglevel + GPalette.BaseColors[color].b * fglevel) >> 10;
|
||||
|
||||
*dest = RGB256k.RGB[dest_r][dest_g][dest_b];
|
||||
dest += spacing;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -989,27 +989,6 @@ void DCanvas::PUTTRANSDOT (int xx, int yy, int basecolor, int level)
|
|||
static int oldyy;
|
||||
static int oldyyshifted;
|
||||
|
||||
#if 0
|
||||
if(xx < 32)
|
||||
cc += 7-(xx>>2);
|
||||
else if(xx > (finit_width - 32))
|
||||
cc += 7-((finit_width-xx) >> 2);
|
||||
// if(cc==oldcc) //make sure that we don't double fade the corners.
|
||||
// {
|
||||
if(yy < 32)
|
||||
cc += 7-(yy>>2);
|
||||
else if(yy > (finit_height - 32))
|
||||
cc += 7-((finit_height-yy) >> 2);
|
||||
// }
|
||||
if(cc > cm && cm != NULL)
|
||||
{
|
||||
cc = cm;
|
||||
}
|
||||
else if(cc > oldcc+6) // don't let the color escape from the fade table...
|
||||
{
|
||||
cc=oldcc+6;
|
||||
}
|
||||
#endif
|
||||
if (yy == oldyy+1)
|
||||
{
|
||||
oldyy++;
|
||||
|
@ -1027,12 +1006,12 @@ void DCanvas::PUTTRANSDOT (int xx, int yy, int basecolor, int level)
|
|||
}
|
||||
|
||||
BYTE *spot = GetBuffer() + oldyyshifted + xx;
|
||||
DWORD *bg2rgb = Col2RGB8[1+level];
|
||||
DWORD *fg2rgb = Col2RGB8[63-level];
|
||||
DWORD fg = fg2rgb[basecolor];
|
||||
DWORD bg = bg2rgb[*spot];
|
||||
bg = (fg+bg) | 0x01f07c1f;
|
||||
*spot = RGB32k.All[bg&(bg>>15)];
|
||||
|
||||
uint32_t r = (GPalette.BaseColors[*spot].r * (64 - level) + GPalette.BaseColors[basecolor].r * level) / 64;
|
||||
uint32_t g = (GPalette.BaseColors[*spot].g * (64 - level) + GPalette.BaseColors[basecolor].g * level) / 64;
|
||||
uint32_t b = (GPalette.BaseColors[*spot].b * (64 - level) + GPalette.BaseColors[basecolor].b * level) / 64;
|
||||
|
||||
*spot = (BYTE)RGB256k.RGB[r][g][b];
|
||||
}
|
||||
|
||||
void DCanvas::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32 realcolor)
|
||||
|
|
|
@ -349,8 +349,6 @@ void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h)
|
|||
if (damount == 0.f)
|
||||
return;
|
||||
|
||||
DWORD *bg2rgb;
|
||||
DWORD fg;
|
||||
int gap;
|
||||
BYTE *spot;
|
||||
int x, y;
|
||||
|
@ -372,28 +370,23 @@ void DCanvas::Dim (PalEntry color, float damount, int x1, int y1, int w, int h)
|
|||
return;
|
||||
}
|
||||
|
||||
{
|
||||
int amount;
|
||||
|
||||
amount = (int)(damount * 64);
|
||||
bg2rgb = Col2RGB8[64-amount];
|
||||
|
||||
fg = (((color.r * amount) >> 4) << 20) |
|
||||
((color.g * amount) >> 4) |
|
||||
(((color.b * amount) >> 4) << 10);
|
||||
}
|
||||
|
||||
spot = Buffer + x1 + y1*Pitch;
|
||||
gap = Pitch - w;
|
||||
|
||||
int alpha = (int)((float)64 * damount);
|
||||
int ialpha = 64 - alpha;
|
||||
int dimmedcolor_r = color.r * alpha;
|
||||
int dimmedcolor_g = color.g * alpha;
|
||||
int dimmedcolor_b = color.b * alpha;
|
||||
for (y = h; y != 0; y--)
|
||||
{
|
||||
for (x = w; x != 0; x--)
|
||||
{
|
||||
DWORD bg;
|
||||
|
||||
bg = bg2rgb[(*spot)&0xff];
|
||||
bg = (fg+bg) | 0x1f07c1f;
|
||||
*spot = RGB32k.All[bg&(bg>>15)];
|
||||
uint32_t r = (dimmedcolor_r + GPalette.BaseColors[*spot].r * ialpha) >> 8;
|
||||
uint32_t g = (dimmedcolor_g + GPalette.BaseColors[*spot].g * ialpha) >> 8;
|
||||
uint32_t b = (dimmedcolor_b + GPalette.BaseColors[*spot].b * ialpha) >> 8;
|
||||
*spot = (BYTE)RGB256k.RGB[r][g][b];
|
||||
spot++;
|
||||
}
|
||||
spot += gap;
|
||||
|
@ -672,7 +665,8 @@ static void BuildTransTable (const PalEntry *palette)
|
|||
for (r = 0; r < 32; r++)
|
||||
for (g = 0; g < 32; g++)
|
||||
for (b = 0; b < 32; b++)
|
||||
RGB32k.RGB[r][g][b] = ColorMatcher.Pick ((r<<3)|(r>>2), (g<<3)|(g>>2), (b<<3)|(b>>2));
|
||||
//RGB32k.RGB[r][g][b] = ColorMatcher.Pick ((r<<3)|(r>>2), (g<<3)|(g>>2), (b<<3)|(b>>2));
|
||||
RGB32k.RGB[r][g][b] = 2;
|
||||
#ifndef NO_RGB666
|
||||
// create the RGB666 lookup table
|
||||
for (r = 0; r < 64; r++)
|
||||
|
|
Loading…
Reference in a new issue