Code clean.
Filtering is only applied in one place, when the texture is loaded (it was being applied in each loading function, i.e. LoadBMP). I tried solving the dots problem of blurring, with no success. git-svn-id: https://svn.code.sf.net/p/q3cellshading/code/trunk@24 db09e94b-7117-0410-a7e6-85ae5ff6e0e9
This commit is contained in:
parent
b04cfb566a
commit
f378cc2a2d
1 changed files with 39 additions and 48 deletions
|
@ -1134,12 +1134,14 @@ byte getImageR(byte *targa_rgba, int x, int y, int columns, int rows)
|
|||
{
|
||||
byte *pixbuf;
|
||||
|
||||
if((x<0)||(x>=columns)||(y<0)||(y>rows))
|
||||
return 0;
|
||||
|
||||
x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);
|
||||
|
||||
pixbuf = targa_rgba + y*columns*4;
|
||||
|
||||
|
||||
if(columns<x)
|
||||
x=x%columns;
|
||||
|
||||
|
@ -1155,8 +1157,10 @@ void setImageR(byte *targa_rgba, int x, int y, int columns, int rows, byte value
|
|||
{
|
||||
byte *pixbuf;
|
||||
|
||||
x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);
|
||||
/*x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);*/
|
||||
if((x<0)||(x>=columns)||(y<0)||(y>rows))
|
||||
return;
|
||||
|
||||
pixbuf = targa_rgba + y*columns*4;
|
||||
|
||||
|
@ -1170,6 +1174,9 @@ byte getImageG(byte *targa_rgba, int x, int y, int columns, int rows)
|
|||
{
|
||||
byte *pixbuf;
|
||||
|
||||
if((x<0)||(x>=columns)||(y<0)||(y>rows))
|
||||
return 0;
|
||||
|
||||
x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);
|
||||
|
||||
|
@ -1191,8 +1198,10 @@ void setImageG(byte *targa_rgba, int x, int y, int columns, int rows, byte value
|
|||
{
|
||||
byte *pixbuf;
|
||||
|
||||
x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);
|
||||
/*x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);*/
|
||||
if((x<0)||(x>=columns)||(y<0)||(y>rows))
|
||||
return;
|
||||
|
||||
pixbuf = targa_rgba + y*columns*4;
|
||||
|
||||
|
@ -1205,6 +1214,9 @@ byte getImageB(byte *targa_rgba, int x, int y, int columns, int rows)
|
|||
{
|
||||
byte *pixbuf;
|
||||
|
||||
if((x<0)||(x>=columns)||(y<0)||(y>rows))
|
||||
return 0;
|
||||
|
||||
x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);
|
||||
|
||||
|
@ -1225,8 +1237,10 @@ void setImageB(byte *targa_rgba, int x, int y, int columns, int rows, byte value
|
|||
{
|
||||
byte *pixbuf;
|
||||
|
||||
x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);
|
||||
/*x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);*/
|
||||
if((x<0)||(x>=columns)||(y<0)||(y>rows))
|
||||
return;
|
||||
|
||||
pixbuf = targa_rgba + y*columns*4;
|
||||
|
||||
|
@ -1239,8 +1253,10 @@ byte getImageA(byte *targa_rgba, int x, int y, int columns, int rows)
|
|||
{
|
||||
byte *pixbuf;
|
||||
|
||||
x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);
|
||||
/*x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);*/
|
||||
if((x<0)||(x>=columns)||(y<0)||(y>rows))
|
||||
return 0;
|
||||
|
||||
pixbuf = targa_rgba + y*columns*4;
|
||||
|
||||
|
@ -1253,8 +1269,10 @@ void setImageA(byte *targa_rgba, int x, int y, int columns, int rows, byte value
|
|||
{
|
||||
byte *pixbuf;
|
||||
|
||||
x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);
|
||||
/*x*=((x<0)?-1:1);
|
||||
y*=((y<0)?-1:1);*/
|
||||
if((x<0)||(x>=columns)||(y<0)||(y>rows))
|
||||
return;
|
||||
|
||||
pixbuf = targa_rgba + y*columns*4;
|
||||
|
||||
|
@ -1437,11 +1455,6 @@ static void LoadBMP( const char *name, byte **pic, int *width, int *height )
|
|||
}
|
||||
}
|
||||
|
||||
if(r_celshadalgo->integer==1)
|
||||
kuwahara(columns,rows ,bmpRGBA);
|
||||
else if(r_celshadalgo->integer==2)
|
||||
whiteTexture(columns,rows,bmpRGBA);
|
||||
|
||||
ri.FS_FreeFile( buffer );
|
||||
|
||||
}
|
||||
|
@ -1547,12 +1560,6 @@ static void LoadPCX ( const char *filename, byte **pic, byte **palette, int *wid
|
|||
*pic = NULL;
|
||||
}
|
||||
|
||||
if(r_celshadalgo->integer==1)
|
||||
kuwahara(xmax,ymax ,pic);
|
||||
else if(r_celshadalgo->integer==2)
|
||||
whiteTexture(xmax,ymax ,pic);
|
||||
|
||||
|
||||
ri.FS_FreeFile (pcx);
|
||||
}
|
||||
|
||||
|
@ -1585,13 +1592,6 @@ static void LoadPCX32 ( const char *filename, byte **pic, int *width, int *heigh
|
|||
pic32 += 4;
|
||||
}
|
||||
|
||||
|
||||
if(r_celshadalgo->integer==1)
|
||||
kuwahara(*width,*height ,pic32);
|
||||
else if(r_celshadalgo->integer==2)
|
||||
whiteTexture(*width,*height ,pic32);
|
||||
|
||||
|
||||
ri.Free (pic8);
|
||||
ri.Free (palette);
|
||||
}
|
||||
|
@ -1846,13 +1846,6 @@ static void LoadTGA ( const char *name, byte **pic, int *width, int *height)
|
|||
}
|
||||
}
|
||||
|
||||
/*jpc algorismes*/
|
||||
|
||||
if(r_celshadalgo->integer==1)
|
||||
kuwahara(columns,rows ,targa_rgba);
|
||||
else if(r_celshadalgo->integer==2)
|
||||
whiteTexture(columns,rows ,targa_rgba);
|
||||
|
||||
|
||||
#if 0
|
||||
// TTimo: this is the chunk of code to ensure a behavior that meets TGA specs
|
||||
|
@ -1999,12 +1992,6 @@ static void LoadJPG( const char *filename, unsigned char **pic, int *width, int
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
if(r_celshadalgo->integer==1)
|
||||
kuwahara(*width,*height ,*pic);
|
||||
else if(r_celshadalgo->integer==2)
|
||||
whiteTexture(*width,*height ,*pic);
|
||||
|
||||
/* Step 7: Finish decompression */
|
||||
|
||||
(void) jpeg_finish_decompress(&cinfo);
|
||||
|
@ -2372,6 +2359,10 @@ void R_LoadImage( const char *name, byte **pic, int *width, int *height ) {
|
|||
} else if ( !Q_stricmp( name+len-4, ".jpg" ) ) {
|
||||
LoadJPG( name, pic, width, height );
|
||||
}
|
||||
if(r_celshadalgo->integer==1)
|
||||
kuwahara(*width,*height,pic);
|
||||
else if(r_celshadalgo->integer==2)
|
||||
whiteTexture(*width,*height,pic);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue