mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-18 02:50:33 +00:00
ref_soft: Merge kernel texture filter
This commit is contained in:
parent
e7785c9ccb
commit
842a15ee45
@ -1195,6 +1195,7 @@ extern cvar_t *sw_reportedgeout;
|
|||||||
extern cvar_t *sw_stipplealpha;
|
extern cvar_t *sw_stipplealpha;
|
||||||
extern cvar_t *sw_surfcacheoverride;
|
extern cvar_t *sw_surfcacheoverride;
|
||||||
extern cvar_t *sw_waterwarp;
|
extern cvar_t *sw_waterwarp;
|
||||||
|
extern cvar_t *sw_texfilt;
|
||||||
|
|
||||||
extern vec3_t modelorg;
|
extern vec3_t modelorg;
|
||||||
extern vec3_t r_origin;
|
extern vec3_t r_origin;
|
||||||
|
3
r_main.c
3
r_main.c
@ -83,6 +83,7 @@ cvar_t *sw_reportsurfout;
|
|||||||
cvar_t *sw_stipplealpha;
|
cvar_t *sw_stipplealpha;
|
||||||
cvar_t *sw_surfcacheoverride;
|
cvar_t *sw_surfcacheoverride;
|
||||||
cvar_t *sw_waterwarp;
|
cvar_t *sw_waterwarp;
|
||||||
|
cvar_t *sw_texfilt;
|
||||||
|
|
||||||
cvar_t *r_drawworld;
|
cvar_t *r_drawworld;
|
||||||
cvar_t *r_drawentities;
|
cvar_t *r_drawentities;
|
||||||
@ -1654,7 +1655,7 @@ qboolean R_Init()
|
|||||||
sw_surfcacheoverride = gEngfuncs.Cvar_Get ("sw_surfcacheoverride", "0", 0, "");
|
sw_surfcacheoverride = gEngfuncs.Cvar_Get ("sw_surfcacheoverride", "0", 0, "");
|
||||||
sw_waterwarp = gEngfuncs.Cvar_Get ("sw_waterwarp", "1", 0, "");
|
sw_waterwarp = gEngfuncs.Cvar_Get ("sw_waterwarp", "1", 0, "");
|
||||||
sw_mode = gEngfuncs.Cvar_Get( "sw_mode", "0", FCVAR_ARCHIVE, "");
|
sw_mode = gEngfuncs.Cvar_Get( "sw_mode", "0", FCVAR_ARCHIVE, "");
|
||||||
|
sw_texfilt = gEngfuncs.Cvar_Get ("sw_texfilt", "0", 0, "texture dither");
|
||||||
//r_lefthand = ri.Cvar_Get( "hand", "0", FCVAR_USERINFO | FCVAR_ARCHIVE );
|
//r_lefthand = ri.Cvar_Get( "hand", "0", FCVAR_USERINFO | FCVAR_ARCHIVE );
|
||||||
// r_speeds = ri.Cvar_Get ("r_speeds", "0", 0);
|
// r_speeds = ri.Cvar_Get ("r_speeds", "0", 0);
|
||||||
|
|
||||||
|
48
r_scan.c
48
r_scan.c
@ -391,6 +391,20 @@ void NonTurbulent8 (espan_t *pspan)
|
|||||||
|
|
||||||
#if !id386
|
#if !id386
|
||||||
|
|
||||||
|
|
||||||
|
int kernel[2][2][2] =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{16384,0},
|
||||||
|
{49152,32768}
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
{32768,49152},
|
||||||
|
{0,16384}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
D_DrawSpans16
|
D_DrawSpans16
|
||||||
@ -511,15 +525,45 @@ void D_DrawSpans16 (espan_t *pspan)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Drawing phrase
|
||||||
|
if (sw_texfilt->value == 0.0f)
|
||||||
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
*pdest++ = *(pbase + (s >> 16) + (t >> 16) * cachewidth);
|
*pdest++ = *(pbase + (s >> 16) + (t >> 16) * cachewidth);
|
||||||
s += sstep;
|
s += sstep;
|
||||||
t += tstep;
|
t += tstep;
|
||||||
} while (--spancount > 0);
|
} while (--spancount > 0);
|
||||||
|
}
|
||||||
|
else if (sw_texfilt->value == 1.0f)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
int idiths = s;
|
||||||
|
int iditht = t;
|
||||||
|
|
||||||
|
int X = (pspan->u + spancount) & 1;
|
||||||
|
int Y = (pspan->v)&1;
|
||||||
|
|
||||||
|
//Using the kernel
|
||||||
|
idiths += kernel[X][Y][0];
|
||||||
|
iditht += kernel[X][Y][1];
|
||||||
|
|
||||||
|
idiths = idiths >> 16;
|
||||||
|
idiths = idiths ? idiths -1 : idiths;
|
||||||
|
|
||||||
|
|
||||||
|
iditht = iditht >> 16;
|
||||||
|
iditht = iditht ? iditht -1 : iditht;
|
||||||
|
|
||||||
|
|
||||||
|
*pdest++ = *(pbase + idiths + iditht * cachewidth);
|
||||||
|
s += sstep;
|
||||||
|
t += tstep;
|
||||||
|
} while (--spancount > 0);
|
||||||
|
}
|
||||||
|
|
||||||
s = snext;
|
|
||||||
t = tnext;
|
|
||||||
|
|
||||||
} while (count > 0);
|
} while (count > 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user