Reverted to old blur algorithm. Anyways, now it doesn't seem to affect the skybox.

git-svn-id: https://svn.code.sf.net/p/q3cellshading/code/trunk@29 db09e94b-7117-0410-a7e6-85ae5ff6e0e9
This commit is contained in:
gmiranda 2006-07-30 22:34:51 +00:00
parent fe9904fb15
commit 3c1057083b
2 changed files with 108 additions and 17 deletions

View file

@ -1,16 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: game - Win32 Release--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
qagamex86.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View file

@ -845,7 +845,7 @@ for(row=rows-1; row>=arow+3; row--)
* @see http://www.filtermeister.com/tutorials/blur02.html * @see http://www.filtermeister.com/tutorials/blur02.html
*/ */
void blur(int columns, int rows, byte *targa_rgba) /*void blur(int columns, int rows, byte *targa_rgba)
{ {
// 4x4 kernel // 4x4 kernel
@ -942,6 +942,113 @@ void blur(int columns, int rows, byte *targa_rgba)
free(t); free(t);
}*/
void blur(int columns, int rows, byte *targa_rgba)
{
int row, column;
float red,green,blue;
float ared,agreen,ablue;
ared=agreen=ablue=128;
//for(row=rows-1; row>=0; row--)
for(row=0; row<rows; row++)
{
//pixbuf = targa_rgba + row*columns*4;
for(column=0; column<columns; column++)
{
red=0;
red+=getImageR(targa_rgba,column-1,row-1,columns,rows);
red+=getImageR(targa_rgba,column,row-1,columns,rows);
red+=getImageR(targa_rgba,column+1,row-1,columns,rows);
red+=getImageR(targa_rgba,column-1,row,columns,rows);
red+=getImageR(targa_rgba,column,row,columns,rows);
red+=getImageR(targa_rgba,column+1,row,columns,rows);
red+=getImageR(targa_rgba,column-1,row+1,columns,rows);
red+=getImageR(targa_rgba,column,row+1,columns,rows);
red+=getImageR(targa_rgba,column+1,row+1,columns,rows);
red/=9;
red*=2;
red+=ared;
red/=3;
red=(int)red/DIVNUM;
red*=DIVNUM;
red+=(DIVNUM/2);
ared=red;
setImageR(targa_rgba, column, row, columns, rows, (byte)red);
////////////////////
green=0;
green+=getImageG(targa_rgba,column-1,row-1,columns,rows);
green+=getImageG(targa_rgba,column,row-1,columns,rows);
green+=getImageG(targa_rgba,column+1,row-1,columns,rows);
green+=getImageG(targa_rgba,column-1,row,columns,rows);
green+=getImageG(targa_rgba,column,row,columns,rows);
green+=getImageG(targa_rgba,column+1,row,columns,rows);
green+=getImageG(targa_rgba,column-1,row+1,columns,rows);
green+=getImageG(targa_rgba,column,row+1,columns,rows);
green+=getImageG(targa_rgba,column+1,row+1,columns,rows);
green/=9;
green*=2;
green+=agreen;
green/=3;
green=(int)green/DIVNUM;
green*=DIVNUM;
green+=(DIVNUM/2);
agreen=green;
setImageG(targa_rgba, column, row, columns, rows, (byte)green);
////////////////////////
blue=0;
blue+=getImageB(targa_rgba,column-1,row-1,columns,rows);
blue+=getImageB(targa_rgba,column,row-1,columns,rows);
blue+=getImageB(targa_rgba,column+1,row-1,columns,rows);
blue+=getImageB(targa_rgba,column-1,row,columns,rows);
blue+=getImageB(targa_rgba,column,row,columns,rows);
blue+=getImageB(targa_rgba,column+1,row,columns,rows);
blue+=getImageB(targa_rgba,column-1,row+1,columns,rows);
blue+=getImageB(targa_rgba,column,row+1,columns,rows);
blue+=getImageB(targa_rgba,column+1,row+1,columns,rows);
blue/=9;
blue*=2;
blue+=ablue;
blue/=3;
blue=(int)blue/DIVNUM;
blue*=DIVNUM;
blue+=(DIVNUM/2);
ablue=blue;
setImageB(targa_rgba, column, row, columns, rows, (byte)blue);
// "halftoning"
/*if((row%5==0)&&(column%5==1))
{
gris=0;
gris+=red;
gris+=green;
gris+=blue;
gris/=3;
gris=255-gris;
if(gris<0)
gris=0;
setImageR(targa_rgba, column, row, columns, rows, (byte)gris);
setImageG(targa_rgba, column, row, columns, rows, (byte)gris);
setImageB(targa_rgba, column, row, columns, rows, (byte)gris);
}*/
}
}
} }