Browse Source

ref_soft: enable stiple alpha by default, cache conveyors

pull/2/head
mittorn 6 years ago
parent
commit
56ef16b0f9
  1. 25
      r_edge.c
  2. 2
      r_main.c
  3. 16
      r_poly.c
  4. 22
      r_surf.c

25
r_edge.c

@ -847,14 +847,15 @@ void D_CalcGradients (msurface_t *pface) @@ -847,14 +847,15 @@ void D_CalcGradients (msurface_t *pface)
tadjust = ((fixed16_t)(DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) -
((pface->texturemins[1] << 16) >> miplevel)
+ pface->texinfo->vecs[1][3]*t;
#if 0
#if 1
// PGM - changing flow speed for non-warping textures.
if (pface->texinfo->flags & SURF_FLOWING)
if (pface->flags & SURF_CONVEYOR)
{
if(pface->texinfo->flags & SURF_WARP)
sadjust += 0x10000 * (-128 * ( (r_newrefdef.time * 0.25) - (int)(r_newrefdef.time * 0.25) ));
if(pface->flags & SURF_DRAWTURB)
sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.25) - (int)(gpGlobals->time * 0.25) ));
else
sadjust += 0x10000 * (-128 * ( (r_newrefdef.time * 0.77) - (int)(r_newrefdef.time * 0.77) ));
sadjust += 0x10000 * (-128 * ( (gpGlobals->time * 0.77) - (int)(gpGlobals->time * 0.77) ));
}
// PGM
#endif
@ -1010,8 +1011,16 @@ void D_SolidSurf (surf_t *s) @@ -1010,8 +1011,16 @@ void D_SolidSurf (surf_t *s)
RI.currententity = gEngfuncs.GetEntityByIndex(0); //r_worldentity;
pface = s->msurf;
if( !pface )
return;
#if 1
miplevel = D_MipLevelForScale(s->nearzi * scale_for_mip );
if( pface->flags & SURF_CONVEYOR )
miplevel = 1;
else
miplevel = D_MipLevelForScale(s->nearzi * scale_for_mip );
#else
{
float dot;
@ -1039,8 +1048,6 @@ void D_SolidSurf (surf_t *s) @@ -1039,8 +1048,6 @@ void D_SolidSurf (surf_t *s)
}
#endif
if( !pface )
return;
// FIXME: make this passed in to D_CacheSurface
pcurrentcache = D_CacheSurface (pface, miplevel);
@ -1125,7 +1132,7 @@ void D_DrawSurfaces (void) @@ -1125,7 +1132,7 @@ void D_DrawSurfaces (void)
#if 1
if(s->flags & SURF_DRAWSKY)
D_BackgroundSurf (s);
else if (s->flags & SURF_DRAWTURB)
else if (s->flags & SURF_DRAWTURB )
D_TurbulentSurf (s);
else
D_SolidSurf (s);

2
r_main.c

@ -1945,7 +1945,7 @@ qboolean R_Init() @@ -1945,7 +1945,7 @@ qboolean R_Init()
sw_mipscale = gEngfuncs.Cvar_Get ("sw_mipscale", "1", 0, "");
sw_reportedgeout = gEngfuncs.Cvar_Get ("sw_reportedgeout", "0", 0, "");
sw_reportsurfout = gEngfuncs.Cvar_Get ("sw_reportsurfout", "0", 0, "");
sw_stipplealpha = gEngfuncs.Cvar_Get( "sw_stipplealpha", "0", FCVAR_ARCHIVE, "" );
sw_stipplealpha = gEngfuncs.Cvar_Get( "sw_stipplealpha", "1", FCVAR_ARCHIVE, "" );
sw_surfcacheoverride = gEngfuncs.Cvar_Get ("sw_surfcacheoverride", "0", 0, "");
sw_waterwarp = gEngfuncs.Cvar_Get ("sw_waterwarp", "1", 0, "");
sw_mode = gEngfuncs.Cvar_Get( "sw_mode", "0", FCVAR_ARCHIVE, "");

16
r_poly.c

@ -252,8 +252,8 @@ void R_DrawSpanletTurbulentBlended66( void ) @@ -252,8 +252,8 @@ void R_DrawSpanletTurbulentBlended66( void )
{
pixel_t screen = *s_spanletvars.pdest;
pixel_t src = btemp;
byte alpha = 4;
*s_spanletvars.pdest = vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0x7f) >> 3 | ((src & 0xff));
byte alpha = 5;
*s_spanletvars.pdest = vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0xff) | ((src & 0xff));
}
s_spanletvars.izi += s_spanletvars.izistep;
@ -281,8 +281,8 @@ void R_DrawSpanletTurbulentBlended33( void ) @@ -281,8 +281,8 @@ void R_DrawSpanletTurbulentBlended33( void )
{
pixel_t screen = *s_spanletvars.pdest;
pixel_t src = btemp;
byte alpha = 4;
*s_spanletvars.pdest = vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0x7f) >> 3 | ((src & 0xff));
byte alpha = 2;
*s_spanletvars.pdest = vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0xff)| ((src & 0xff));
}
s_spanletvars.izi += s_spanletvars.izistep;
@ -316,8 +316,8 @@ void R_DrawSpanlet33( void ) @@ -316,8 +316,8 @@ void R_DrawSpanlet33( void )
{
pixel_t screen = *s_spanletvars.pdest;
pixel_t src = btemp;
byte alpha = 4;
*s_spanletvars.pdest = vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0x7f) >> 3 | ((src & 0xff));
byte alpha = 2;
*s_spanletvars.pdest = vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0xff)| ((src & 0xff));
}
}
@ -367,8 +367,8 @@ void R_DrawSpanlet66( void ) @@ -367,8 +367,8 @@ void R_DrawSpanlet66( void )
{
pixel_t screen = *s_spanletvars.pdest;
pixel_t src = btemp;
byte alpha = 4;
*s_spanletvars.pdest = vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0x7f) >> 3 | ((src & 0xff));
byte alpha = 5;
*s_spanletvars.pdest = vid.alphamap[( alpha << 16)|(src & 0xff00)|(screen>>8)] << 8 | (screen & 0xff)| ((src & 0xff));
}
}

22
r_surf.c

@ -187,6 +187,14 @@ static void R_BuildLightMap( ) @@ -187,6 +187,14 @@ static void R_BuildLightMap( )
size = smax * tmax;
if( surf->flags & SURF_CONVEYOR )
{
smax = ( info->lightextents[0] * 3 / sample_size ) + 1;
size = smax * tmax;
memset( blocklights, 0xff, sizeof( uint ) * size );
return;
}
lm = surf->samples;
memset( blocklights, 0, sizeof( uint ) * size );
@ -1101,6 +1109,19 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) @@ -1101,6 +1109,19 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel)
//
r_drawsurf.image = R_GetTexture(R_TextureAnimation (surface)->gl_texturenum);
if( surface->flags & SURF_CONVEYOR )
{
if( miplevel >= 1)
{
surface->extents[0] = surface->info->lightextents[0] * gEngfuncs.Mod_SampleSizeForFace( r_drawsurf.surf ) * 2 ;
surface->texturemins[0] = -surface->info->lightextents[0] * gEngfuncs.Mod_SampleSizeForFace( r_drawsurf.surf );
}
else
{
surface->extents[0] = surface->info->lightextents[0] * gEngfuncs.Mod_SampleSizeForFace( r_drawsurf.surf ) ;
surface->texturemins[0] = -surface->info->lightextents[0] * gEngfuncs.Mod_SampleSizeForFace( r_drawsurf.surf )/2;
}
}
/// todo: port this
//r_drawsurf.lightadj[0] = r_newrefdef.lightstyles[surface->styles[0]].white*128;
//r_drawsurf.lightadj[1] = r_newrefdef.lightstyles[surface->styles[1]].white*128;
@ -1138,6 +1159,7 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) @@ -1138,6 +1159,7 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel)
r_drawsurf.surfwidth = surface->extents[0] >> miplevel;
r_drawsurf.rowbytes = r_drawsurf.surfwidth;
r_drawsurf.surfheight = surface->extents[1] >> miplevel;
//
// allocate memory if needed

Loading…
Cancel
Save