mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-29 00:04:15 +00:00
ref_soft: FillRGBA, FillRGBABlend
This commit is contained in:
parent
cefe42fd66
commit
c08c35df69
@ -106,7 +106,9 @@ CL_FillRGBA
|
||||
*/
|
||||
static void CL_FillRGBA( float _x, float _y, float _w, float _h, int r, int g, int b, int a )
|
||||
{
|
||||
|
||||
vid.rendermode = kRenderTransAdd;
|
||||
_TriColor4ub(r,g,b,a);
|
||||
Draw_Fill(_x,_y,_w,_h);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -117,7 +119,9 @@ pfnFillRGBABlend
|
||||
*/
|
||||
static void GAME_EXPORT CL_FillRGBABlend( float _x, float _y, float _w, float _h, int r, int g, int b, int a )
|
||||
{
|
||||
|
||||
vid.rendermode = kRenderTransAlpha;
|
||||
_TriColor4ub(r,g,b,a);
|
||||
Draw_Fill(_x,_y,_w,_h);
|
||||
}
|
||||
|
||||
|
||||
|
78
r_draw.c
78
r_draw.c
@ -199,10 +199,82 @@ void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, f
|
||||
R_DrawStretchPicImplementation(x,y,w,h, pic->width * s1, pic->height * t1, pic->width * s2, pic->height * t2, pic);
|
||||
}
|
||||
|
||||
void Draw_Fill (int x, int y, int w, int h, int c)
|
||||
void Draw_Fill (int x, int y, int w, int h)
|
||||
{
|
||||
// todo: color
|
||||
R_DrawStretchPicImplementation(x,y,w,h, 0, 0, 12, 1, tr.whiteTexture );
|
||||
pixel_t *dest;
|
||||
unsigned int v, u;
|
||||
unsigned int height;
|
||||
int skip;
|
||||
pixel_t src = vid.color;
|
||||
int alpha = vid.alpha;
|
||||
|
||||
if( x < 0 )
|
||||
x = 0;
|
||||
|
||||
if( x + w > vid.width )
|
||||
w = vid.width - x;
|
||||
|
||||
if( y + h > vid.height )
|
||||
h = vid.height - y;
|
||||
|
||||
height = h;
|
||||
if (y < 0)
|
||||
{
|
||||
skip = -y;
|
||||
height += y;
|
||||
y = 0;
|
||||
}
|
||||
else
|
||||
skip = 0;
|
||||
|
||||
dest = vid.buffer + y * vid.rowbytes + x;
|
||||
|
||||
#pragma omp parallel for schedule(static)
|
||||
for (v=0 ; v<height ; v++)
|
||||
{
|
||||
#ifdef _OPENMP
|
||||
pixel_t *dest = vid.buffer + (y + v) * vid.rowbytes + x;
|
||||
#endif
|
||||
|
||||
{
|
||||
|
||||
#if 0
|
||||
for (u=0 ; u<w ; u+=4)
|
||||
{
|
||||
dest[u] = source[f>>16];
|
||||
f += fstep;
|
||||
dest[u+1] = source[f>>16];
|
||||
f += fstep;
|
||||
dest[u+2] = source[f>>16];
|
||||
f += fstep;
|
||||
dest[u+3] = source[f>>16];
|
||||
f += fstep;
|
||||
}
|
||||
#else
|
||||
for (u=0 ; u<w ; u++)
|
||||
{
|
||||
if( alpha == 0 )
|
||||
continue;
|
||||
|
||||
if( vid.rendermode == kRenderTransAdd)
|
||||
{
|
||||
pixel_t screen = dest[u];
|
||||
dest[u] = vid.addmap[src & 0xff00|(screen>>8)] << 8 | (screen & 0xff) | ((src & 0xff) >> 0);
|
||||
}
|
||||
else if( alpha < 7) // && (vid.rendermode == kRenderTransAlpha || vid.rendermode == kRenderTransTexture ) )
|
||||
{
|
||||
pixel_t screen = dest[u]; // | 0xff & screen & src ;
|
||||
dest[u] = BLEND_ALPHA( alpha, src, screen);//vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0xff) >> 3 | ((src & 0xff) >> 3);
|
||||
|
||||
}
|
||||
else
|
||||
dest[u] = src;
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
dest += vid.rowbytes;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1252,7 +1252,7 @@ void D_FlushCaches( qboolean newmap );
|
||||
//
|
||||
// r_draw.c
|
||||
//
|
||||
void Draw_Fill (int x, int y, int w, int h, int c);
|
||||
void Draw_Fill (int x, int y, int w, int h);
|
||||
|
||||
//
|
||||
// r_misc.c
|
||||
|
Loading…
x
Reference in New Issue
Block a user