Browse Source

ref_soft: Studio alpha blending

pull/2/head
mittorn 6 years ago
parent
commit
9b158f5926
  1. 2
      r_draw.c
  2. 5
      r_main.c
  3. 28
      r_poly.c
  4. 26
      r_polyse.c

2
r_draw.c

@ -166,7 +166,7 @@ void R_DrawStretchPicImplementation (int x, int y, int w, int h, int s1, int t1, @@ -166,7 +166,7 @@ void R_DrawStretchPicImplementation (int x, int y, int w, int h, int s1, int t1,
pixel_t screen = dest[u];
dest[u] = vid.addmap[src & 0xff00|(screen>>8)] << 8 | (screen & 0xff) | ((src & 0xff) >> 0);
}
else if( alpha < 0) // && (vid.rendermode == kRenderTransAlpha || vid.rendermode == kRenderTransTexture ) )
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);

5
r_main.c

@ -1023,6 +1023,8 @@ void R_DrawEntitiesOnList( void ) @@ -1023,6 +1023,8 @@ void R_DrawEntitiesOnList( void )
//RI.currententity = gEngfuncs.GetEntityByIndex(0);
extern void (*d_pdrawspans)(void *);
extern void R_PolysetFillSpans8 ( void * );
extern void R_PolysetDrawSpansConstant8_33( void *pspanpackage);
extern void R_PolysetDrawSpans8_33( void *pspanpackage);
d_pdrawspans = R_PolysetFillSpans8;
// first draw solid entities
for( i = 0; i < tr.draw_list->num_solid_entities && !RI.onlyClientDraw; i++ )
@ -1109,7 +1111,7 @@ void R_DrawEntitiesOnList( void ) @@ -1109,7 +1111,7 @@ void R_DrawEntitiesOnList( void )
gEngfuncs.pfnDrawNormalTriangles();
// GL_CheckForErrors();
d_pdrawspans = R_PolysetDrawSpans8_33;
// then draw translucent entities
for( i = 0; i < tr.draw_list->num_trans_entities && !RI.onlyClientDraw; i++ )
{
@ -1166,6 +1168,7 @@ void R_DrawEntitiesOnList( void ) @@ -1166,6 +1168,7 @@ void R_DrawEntitiesOnList( void )
//GL_CheckForErrors();
// pglDisable( GL_BLEND ); // Trinity Render issues
d_pdrawspans = R_PolysetFillSpans8;
R_SetUpWorldTransform();
if( !RI.onlyClientDraw )

28
r_poly.c

@ -62,7 +62,7 @@ static void R_DrawPoly( qboolean iswater ); @@ -62,7 +62,7 @@ static void R_DrawPoly( qboolean iswater );
*/
void R_DrawSpanletOpaque( void )
{
unsigned btemp;
pixel_t btemp;
do
{
@ -94,7 +94,7 @@ void R_DrawSpanletOpaque( void ) @@ -94,7 +94,7 @@ void R_DrawSpanletOpaque( void )
*/
void R_DrawSpanletTurbulentStipple33( void )
{
unsigned btemp;
pixel_t btemp;
int sturb, tturb;
pixel_t *pdest = s_spanletvars.pdest;
short *pz = s_spanletvars.pz;
@ -151,7 +151,7 @@ void R_DrawSpanletTurbulentStipple33( void ) @@ -151,7 +151,7 @@ void R_DrawSpanletTurbulentStipple33( void )
*/
void R_DrawSpanletTurbulentStipple66( void )
{
unsigned btemp;
pixel_t btemp;
int sturb, tturb;
pixel_t *pdest = s_spanletvars.pdest;
short *pz = s_spanletvars.pz;
@ -238,7 +238,7 @@ void R_DrawSpanletTurbulentStipple66( void ) @@ -238,7 +238,7 @@ void R_DrawSpanletTurbulentStipple66( void )
*/
void R_DrawSpanletTurbulentBlended66( void )
{
unsigned btemp;
pixel_t btemp;
int sturb, tturb;
do
@ -267,7 +267,7 @@ void R_DrawSpanletTurbulentBlended66( void ) @@ -267,7 +267,7 @@ void R_DrawSpanletTurbulentBlended66( void )
void R_DrawSpanletTurbulentBlended33( void )
{
unsigned btemp;
pixel_t btemp;
int sturb, tturb;
do
@ -299,7 +299,7 @@ void R_DrawSpanletTurbulentBlended33( void ) @@ -299,7 +299,7 @@ void R_DrawSpanletTurbulentBlended33( void )
*/
void R_DrawSpanlet33( void )
{
unsigned btemp;
pixel_t btemp;
do
{
@ -310,7 +310,7 @@ void R_DrawSpanlet33( void ) @@ -310,7 +310,7 @@ void R_DrawSpanlet33( void )
btemp = *(s_spanletvars.pbase + (ts) + (tt) * cachewidth);
if ( btemp != 255 )
if ( btemp != TRANSPARENT_COLOR )
{
if (*s_spanletvars.pz <= (s_spanletvars.izi >> 16))
{
@ -350,7 +350,7 @@ void R_DrawSpanletConstant33( void ) @@ -350,7 +350,7 @@ void R_DrawSpanletConstant33( void )
*/
void R_DrawSpanlet66( void )
{
unsigned btemp;
pixel_t btemp;
do
{
@ -361,7 +361,7 @@ void R_DrawSpanlet66( void ) @@ -361,7 +361,7 @@ void R_DrawSpanlet66( void )
btemp = *(s_spanletvars.pbase + (ts) + (tt) * cachewidth);
if ( btemp != 255 )
if ( btemp != TRANSPARENT_COLOR )
{
if (*s_spanletvars.pz <= (s_spanletvars.izi >> 16))
{
@ -386,7 +386,7 @@ void R_DrawSpanlet66( void ) @@ -386,7 +386,7 @@ void R_DrawSpanlet66( void )
*/
void R_DrawSpanlet33Stipple( void )
{
unsigned btemp;
pixel_t btemp;
pixel_t *pdest = s_spanletvars.pdest;
short *pz = s_spanletvars.pz;
int izi = s_spanletvars.izi;
@ -422,7 +422,7 @@ void R_DrawSpanlet33Stipple( void ) @@ -422,7 +422,7 @@ void R_DrawSpanlet33Stipple( void )
btemp = *( s_spanletvars.pbase + ( s ) + ( t * cachewidth ) );
if ( btemp != 255 )
if ( btemp != TRANSPARENT_COLOR )
{
if ( *pz <= ( izi >> 16 ) )
*pdest = btemp;
@ -445,7 +445,7 @@ void R_DrawSpanlet33Stipple( void ) @@ -445,7 +445,7 @@ void R_DrawSpanlet33Stipple( void )
*/
void R_DrawSpanlet66Stipple( void )
{
unsigned btemp;
pixel_t btemp;
pixel_t *pdest = s_spanletvars.pdest;
short *pz = s_spanletvars.pz;
int izi = s_spanletvars.izi;
@ -481,7 +481,7 @@ void R_DrawSpanlet66Stipple( void ) @@ -481,7 +481,7 @@ void R_DrawSpanlet66Stipple( void )
btemp = *( s_spanletvars.pbase + ( s ) + ( t * cachewidth ) );
if ( btemp != 255 )
if ( btemp != TRANSPARENT_COLOR )
{
if ( *pz <= ( izi >> 16 ) )
*pdest = btemp;
@ -506,7 +506,7 @@ void R_DrawSpanlet66Stipple( void ) @@ -506,7 +506,7 @@ void R_DrawSpanlet66Stipple( void )
btemp = *( s_spanletvars.pbase + ( s ) + ( t * cachewidth ) );
if ( btemp != 255 )
if ( btemp != TRANSPARENT_COLOR )
{
if ( *pz <= ( izi >> 16 ) )
*pdest = btemp;

26
r_polyse.c

@ -820,8 +820,8 @@ R_PolysetDrawSpans8 @@ -820,8 +820,8 @@ R_PolysetDrawSpans8
void R_PolysetDrawSpans8_33( spanpackage_t *pspanpackage)
{
int lcount;
byte *lpdest;
byte *lptex;
pixel_t *lpdest;
pixel_t *lptex;
int lsfrac, ltfrac;
int llight;
int lzi;
@ -856,9 +856,13 @@ void R_PolysetDrawSpans8_33( spanpackage_t *pspanpackage) @@ -856,9 +856,13 @@ void R_PolysetDrawSpans8_33( spanpackage_t *pspanpackage)
{
if ((lzi >> 16) >= *lpz)
{
int temp = vid.colormap[*lptex + ( llight & 0xFF00 )];
pixel_t temp = *lptex;//vid.colormap[*lptex + ( llight & 0xFF00 )];
*lpdest = vid.alphamap[temp+ *lpdest*256];
int alpha = tr.blend * 7;
if( alpha == 7 )
*lpdest = temp;
else if(alpha)
*lpdest = BLEND_ALPHA(alpha,temp,*lpdest);//vid.alphamap[temp+ *lpdest*256];
}
lpdest++;
lzi += r_zistepx;
@ -884,7 +888,7 @@ void R_PolysetDrawSpans8_33( spanpackage_t *pspanpackage) @@ -884,7 +888,7 @@ void R_PolysetDrawSpans8_33( spanpackage_t *pspanpackage)
void R_PolysetDrawSpansConstant8_33( spanpackage_t *pspanpackage)
{
int lcount;
byte *lpdest;
pixel_t *lpdest;
int lzi;
short *lpz;
@ -913,7 +917,7 @@ void R_PolysetDrawSpansConstant8_33( spanpackage_t *pspanpackage) @@ -913,7 +917,7 @@ void R_PolysetDrawSpansConstant8_33( spanpackage_t *pspanpackage)
{
if ((lzi >> 16) >= *lpz)
{
*lpdest = vid.alphamap[r_aliasblendcolor + *lpdest*256];
*lpdest = BLEND_ALPHA(2,r_aliasblendcolor,*lpdest);//vid.alphamap[r_aliasblendcolor + *lpdest*256];
}
lpdest++;
lzi += r_zistepx;
@ -928,8 +932,8 @@ void R_PolysetDrawSpansConstant8_33( spanpackage_t *pspanpackage) @@ -928,8 +932,8 @@ void R_PolysetDrawSpansConstant8_33( spanpackage_t *pspanpackage)
void R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage)
{
int lcount;
byte *lpdest;
byte *lptex;
pixel_t *lpdest;
pixel_t *lptex;
int lsfrac, ltfrac;
int llight;
int lzi;
@ -966,7 +970,7 @@ void R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage) @@ -966,7 +970,7 @@ void R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage)
{
int temp = vid.colormap[*lptex + ( llight & 0xFF00 )];
*lpdest = vid.alphamap[temp*256 + *lpdest];
*lpdest = BLEND_ALPHA(5,temp,*lpdest);//vid.alphamap[temp*256 + *lpdest];
*lpz = lzi >> 16;
}
lpdest++;
@ -993,7 +997,7 @@ void R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage) @@ -993,7 +997,7 @@ void R_PolysetDrawSpans8_66(spanpackage_t *pspanpackage)
void R_PolysetDrawSpansConstant8_66( spanpackage_t *pspanpackage)
{
int lcount;
byte *lpdest;
pixel_t *lpdest;
int lzi;
short *lpz;
@ -1022,7 +1026,7 @@ void R_PolysetDrawSpansConstant8_66( spanpackage_t *pspanpackage) @@ -1022,7 +1026,7 @@ void R_PolysetDrawSpansConstant8_66( spanpackage_t *pspanpackage)
{
if ((lzi >> 16) >= *lpz)
{
*lpdest = vid.alphamap[r_aliasblendcolor*256 + *lpdest];
*lpdest = BLEND_ALPHA(5,r_aliasblendcolor,*lpdest);//vid.alphamap[r_aliasblendcolor*256 + *lpdest];
}
lpdest++;
lzi += r_zistepx;

Loading…
Cancel
Save