mipmapped non-square textures no longer look terrible.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3298 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
ccf1338d41
commit
fdf09ce18b
1 changed files with 14 additions and 7 deletions
|
@ -2914,18 +2914,25 @@ void GL_MipMap (qbyte *in, int width, int height)
|
|||
{
|
||||
int i, j;
|
||||
qbyte *out;
|
||||
qbyte *inrow;
|
||||
|
||||
width <<=2;
|
||||
//with npot
|
||||
int rowwidth = width*4; //rowwidth is the byte width of the input
|
||||
inrow = in;
|
||||
|
||||
width >>= 1; //ensure its truncated, so don't merge with the *8
|
||||
height >>= 1;
|
||||
out = in;
|
||||
for (i=0 ; i<height ; i++, in+=width)
|
||||
|
||||
|
||||
for (i=0 ; i<height ; i++, inrow+=rowwidth*2)
|
||||
{
|
||||
for (j=0 ; j<width ; j+=8, out+=4, in+=8)
|
||||
for (in = inrow, j=0 ; j<width ; j++, out+=4, in+=8)
|
||||
{
|
||||
out[0] = (in[0] + in[4] + in[width+0] + in[width+4])>>2;
|
||||
out[1] = (in[1] + in[5] + in[width+1] + in[width+5])>>2;
|
||||
out[2] = (in[2] + in[6] + in[width+2] + in[width+6])>>2;
|
||||
out[3] = (in[3] + in[7] + in[width+3] + in[width+7])>>2;
|
||||
out[0] = (in[0] + in[4] + in[rowwidth+0] + in[rowwidth+4])>>2;
|
||||
out[1] = (in[1] + in[5] + in[rowwidth+1] + in[rowwidth+5])>>2;
|
||||
out[2] = (in[2] + in[6] + in[rowwidth+2] + in[rowwidth+6])>>2;
|
||||
out[3] = (in[3] + in[7] + in[rowwidth+3] + in[rowwidth+7])>>2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue