From 3c1ad6a295af33ee97847d80ff1e007369bdf96f Mon Sep 17 00:00:00 2001 From: Matt Ebb Date: Sat, 29 Dec 2007 05:17:19 +0000 Subject: * Displacement map baking This is an extension on the work Brecht already did to implement normal map baking. I've updated the release notes page here with info and pics: http://www.blender.org/development/current-projects/changes-since-244/render-baking/ --- source/blender/imbuf/intern/filter.c | 54 ++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) (limited to 'source/blender/imbuf') diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c index fd9dac1af2b..172342c913c 100644 --- a/source/blender/imbuf/intern/filter.c +++ b/source/blender/imbuf/intern/filter.c @@ -242,7 +242,7 @@ void IMB_filter(struct ImBuf *ibuf) #define EXTEND_PIXEL(a, w) if((a)[3]) {r+= w*(a)[0]; g+= w*(a)[1]; b+= w*(a)[2]; tot+=w;} -/* if alpha is zero, it checks surrounding pixels and averages color. sets new alphas to 255 */ +/* if alpha is zero, it checks surrounding pixels and averages color. sets new alphas to 1.0 */ void IMB_filter_extend(struct ImBuf *ibuf) { register char *row1, *row2, *row3; @@ -251,7 +251,57 @@ void IMB_filter_extend(struct ImBuf *ibuf) rowlen= ibuf->x; - if(ibuf->rect) { + + if (ibuf->rect_float) { + float *temprect; + float *row1f, *row2f, *row3f; + float *fp; + int pixlen = 4; + temprect= MEM_dupallocN(ibuf->rect_float); + + for(y=1; y<=ibuf->y; y++) { + /* setup rows */ + row1f= (float *)(temprect + (y-2)*rowlen*4); + row2f= row1f + 4*rowlen; + row3f= row2f + 4*rowlen; + if(y==1) + row1f= row2f; + else if(y==ibuf->y) + row3f= row2f; + + fp= (float *)(ibuf->rect_float + (y-1)*rowlen*4); + + for(x=0; xrect) { int *temprect; /* make a copy, to prevent flooding */ -- cgit v1.2.3