? source/creator/winbuildinfo.h ? tools/Blender.pyc ? tools/__init__.pyc ? tools/bcolors.pyc ? tools/btools.pyc Index: source/blender/blenkernel/intern/node_composite.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/blenkernel/intern/node_composite.c,v retrieving revision 1.62 diff -u -r1.62 node_composite.c --- source/blender/blenkernel/intern/node_composite.c 14 Sep 2006 12:21:18 -0000 1.62 +++ source/blender/blenkernel/intern/node_composite.c 18 Sep 2006 13:59:44 -0000 @@ -2265,13 +2265,52 @@ static bNodeSocketType cmp_node_blur_in[]= { { SOCK_RGBA, 1, "Image", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, { SOCK_VALUE, 1, "Size", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, + { SOCK_VALUE, 1, "Rotation", 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 360.0f}, { -1, 0, "" } }; static bNodeSocketType cmp_node_blur_out[]= { { SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, { -1, 0, "" } }; +/* function assumes out to be zero'ed, only does RGBA */ +static void bilinear_interpolation_blur(CompBuf *in, float *out, float u, float v) +{ + float *row1, *row2, *row3, *row4, a, b; + float a_b, ma_b, a_mb, ma_mb; + float empty[4]= {0.0f, 0.0f, 0.0f, 0.0f}; + int y1, y2, x1, x2; + + x1= (int)floor(u); + x2= (int)ceil(u); + y1= (int)floor(v); + y2= (int)ceil(v); + /* sample area entirely outside image? */ + if(x2<0 || x1>in->x-1 || y2<0 || y1>in->y-1) + return; + + /* sample including outside of edges of image */ + if(x1<0 || y1<0) row1= empty; + else row1= in->rect + in->x * y1 * in->type + in->type*x1; + + if(x1<0 || y2>in->y-1) row2= empty; + else row2= in->rect + in->x * y2 * in->type + in->type*x1; + + if(x2>in->x-1 || y1<0) row3= empty; + else row3= in->rect + in->x * y1 * in->type + in->type*x2; + + if(x2>in->x-1 || y2>in->y-1) row4= empty; + else row4= in->rect + in->x * y2 * in->type + in->type*x2; + + a= u-floor(u); + b= v-floor(v); + a_b= a*b; ma_b= (1.0f-a)*b; a_mb= a*(1.0f-b); ma_mb= (1.0f-a)*(1.0f-b); + + out[0]= ma_mb*row1[0] + a_mb*row3[0] + ma_b*row2[0]+ a_b*row4[0]; + out[1]= ma_mb*row1[1] + a_mb*row3[1] + ma_b*row2[1]+ a_b*row4[1]; + out[2]= ma_mb*row1[2] + a_mb*row3[2] + ma_b*row2[2]+ a_b*row4[2]; + out[3]= ma_mb*row1[3] + a_mb*row3[3] + ma_b*row2[3]+ a_b*row4[3]; +} static float *make_gausstab(int filtertype, int rad) { float *gausstab, sum, val; @@ -2313,7 +2352,7 @@ } /* both input images of same type, either 4 or 1 channel */ -static void blur_single_image(CompBuf *new, CompBuf *img, float scale, NodeBlurData *nbd) +static void blur_single_image(CompBuf *new, CompBuf *img, float scale, NodeBlurData *nbd, float angle) { CompBuf *work; register float sum, val; @@ -2322,11 +2361,18 @@ int rad, imgx= img->x, imgy= img->y; int x, y, pix= img->type; int i, bigstep; - float *src, *dest; - + float *src, *dest, m, n, radn,ydd,xdd,c,s; + float srcdd[4]={0.0f, 0.0f, 0.0f, 0.0f}; + /* helper image */ work= alloc_compbuf(imgx, imgy, img->type, 1); // allocs + /* directional rect */ + radn = (M_PI * angle) / 180.0f; + m= tan(radn); + c= cos(radn); + s= sin(radn); + /* horizontal */ rad = scale*(float)nbd->sizex; if(rad>imgx/2) @@ -2348,15 +2394,24 @@ src= srcd + pix*(x+minr); + /*directional rect */ + n= y - m * x; + sum= gval = rval= bval= aval= 0.0f; for (i= minr; i < maxr; i++) { + /* calcul next y */ + ydd=y+s*i; + xdd=x+c*i; + /* interpolateion x,ydd*/ + bilinear_interpolation_blur(img, srcdd, xdd, ydd); + val= gausstabcent[i]; sum+= val; - rval += val * (*src++); + rval += val * (srcdd[0]); if(pix==4) { - gval += val * (*src++); - bval += val * (*src++); - aval += val * (*src++); + gval += val * (srcdd[1]); + bval += val * (srcdd[2]); + aval += val * (srcdd[3]); } } sum= 1.0f/sum; @@ -2704,7 +2759,7 @@ else blurd[0]= refd[0]; } - blur_single_image(blurbuf, blurbuf, 1.0f, nbd); + blur_single_image(blurbuf, blurbuf, 1.0f, nbd,0); /* horizontal */ radx = (float)nbd->sizex; @@ -2839,7 +2894,7 @@ if(nbd->bokeh) bokeh_single_image(new, gammabuf, in[1]->vec[0], nbd); else if(1) - blur_single_image(new, gammabuf, in[1]->vec[0], nbd); + blur_single_image(new, gammabuf, in[1]->vec[0], nbd, in[2]->vec[0]); else /* bloom experimental... */ bloom_with_reference(new, gammabuf, NULL, in[1]->vec[0], nbd); Index: source/blender/makesdna/DNA_node_types.h =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_node_types.h,v retrieving revision 1.15 diff -u -r1.15 DNA_node_types.h --- source/blender/makesdna/DNA_node_types.h 10 Aug 2006 10:38:50 -0000 1.15 +++ source/blender/makesdna/DNA_node_types.h 14 Sep 2006 17:20:05 -0000 @@ -189,7 +189,7 @@ float fac; short filtertype; char bokeh, gamma; - int pad2; + int pad2,rot; } NodeBlurData; typedef struct NodeHueSat {