Announcement

Collapse
No announcement yet.

Inner Mysteries of "WinQuakey" Clients

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    They didn't call it "the last great software renderer" for nothing, you know.

    To be honest, there is so much stuff badly broken in GLQuake that it really needs a top to bottom rewrite.

    Incidentially, most of the "washed out" GLQuake look comes from the way it generates mipmaps. Traditional box filter approaches do end up throwing away a lot of the colour info. You can get much better results by using the following...

    Code:
    // top of gl_draw.c
    int ls_up_table[256];
    byte ls_dn_table[200000];
    
    // in Draw_Init
    for (i = 0; i < 256; i++)
    	ls_up_table[i] = pow (i, 2.2);
    
    for (i = 0; i < 200000; i++)
    {
    	float f = pow (i, 0.454545) + 0.5f;;
    
    	ls_dn_table[i] = (byte) (f > 255 ? 255 : f);
    }
    
    // replacement for GL_Mipmap
    void GL_MipMap (byte *in, int width, int height)
    {
    	int i, j;
    	byte *out;
    
    	width <<= 2;
    	height >>= 1;
    	out = in;
    
    	for (i = 0; i < height; i++, in += width)
    	{
    		for (j = 0; j < width; j += 8, out += 4, in += 8)
    		{
    			byte *in2 = &in[width];
    
    			out[0] = ls_dn_table[((ls_up_table[in[0]] + ls_up_table[in[4]] + ls_up_table[in2[0]] + ls_up_table[in2[4]]) >> 2)];
    			out[1] = ls_dn_table[((ls_up_table[in[1]] + ls_up_table[in[5]] + ls_up_table[in2[1]] + ls_up_table[in2[5]]) >> 2)];
    			out[2] = ls_dn_table[((ls_up_table[in[2]] + ls_up_table[in[6]] + ls_up_table[in2[2]] + ls_up_table[in2[6]]) >> 2)];
    
    			// leave alpha as is
    			out[3] = (in[3] + in[7] + in2[3] + in2[7]) >> 2;
    		}
    	}
    }
    Last edited by MH; 05-05-2008, 09:41 AM.
    IT LIVES! http://directq.blogspot.com/

    Comment

    Working...
    X