Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/render/intern/source/rendercore.c')
-rw-r--r--source/blender/render/intern/source/rendercore.c80
1 files changed, 6 insertions, 74 deletions
diff --git a/source/blender/render/intern/source/rendercore.c b/source/blender/render/intern/source/rendercore.c
index bc6c4795f5c..0087be8cca9 100644
--- a/source/blender/render/intern/source/rendercore.c
+++ b/source/blender/render/intern/source/rendercore.c
@@ -2018,74 +2018,6 @@ typedef struct BakeShade {
short *do_update;
} BakeShade;
-/* bake uses a char mask to know what has been baked */
-#define BAKE_MASK_NULL 0
-#define BAKE_MASK_MARGIN 1
-#define BAKE_MASK_BAKED 2
-static void bake_mask_filter_extend( char *mask, int width, int height )
-{
- char *row1, *row2, *row3;
- int rowlen, x, y;
- char *temprect;
-
- rowlen= width;
-
- /* make a copy, to prevent flooding */
- temprect= MEM_dupallocN(mask);
-
- for(y=1; y<=height; y++) {
- /* setup rows */
- row1= (char *)(temprect + (y-2)*rowlen);
- row2= row1 + rowlen;
- row3= row2 + rowlen;
- if(y==1)
- row1= row2;
- else if(y==height)
- row3= row2;
-
- for(x=0; x<rowlen; x++) {
- if (mask[((y-1)*rowlen)+x]==0) {
- if (*row1 || *row2 || *row3 || *(row1+1) || *(row3+1) ) {
- mask[((y-1)*rowlen)+x] = BAKE_MASK_MARGIN;
- } else if((x!=rowlen-1) && (*(row1+2) || *(row2+2) || *(row3+2)) ) {
- mask[((y-1)*rowlen)+x] = BAKE_MASK_MARGIN;
- }
- }
-
- if(x!=0) {
- row1++; row2++; row3++;
- }
- }
- }
- MEM_freeN(temprect);
-}
-
-static void bake_mask_clear( ImBuf *ibuf, char *mask, char val )
-{
- int x,y;
- if (ibuf->rect_float) {
- for(x=0; x<ibuf->x; x++) {
- for(y=0; y<ibuf->y; y++) {
- if (mask[ibuf->x*y + x] == val) {
- float *col= ibuf->rect_float + 4*(ibuf->x*y + x);
- col[0] = col[1] = col[2] = col[3] = 0.0f;
- }
- }
- }
-
- } else {
- /* char buffer */
- for(x=0; x<ibuf->x; x++) {
- for(y=0; y<ibuf->y; y++) {
- if (mask[ibuf->x*y + x] == val) {
- char *col= (char *)(ibuf->rect + ibuf->x*y + x);
- col[0] = col[1] = col[2] = col[3] = 0;
- }
- }
- }
- }
-}
-
static void bake_set_shade_input(ObjectInstanceRen *obi, VlakRen *vlr, ShadeInput *shi, int quad, int isect, int x, int y, float u, float v)
{
if(quad)
@@ -2281,7 +2213,7 @@ static void bake_shade(void *handle, Object *ob, ShadeInput *shi, int quad, int
}
if (bs->rect_mask) {
- bs->rect_mask[bs->rectx*y + x] = BAKE_MASK_BAKED;
+ bs->rect_mask[bs->rectx*y + x] = FILTER_MASK_USED;
}
}
@@ -2308,7 +2240,7 @@ static void bake_displacement(void *handle, ShadeInput *shi, float dist, int x,
col[3]= 255;
}
if (bs->rect_mask) {
- bs->rect_mask[bs->rectx*y + x] = BAKE_MASK_BAKED;
+ bs->rect_mask[bs->rectx*y + x] = FILTER_MASK_USED;
}
}
@@ -2750,16 +2682,16 @@ int RE_bake_shade_all_selected(Render *re, int type, Object *actob, short *do_up
char *temprect;
for(a=0; a<re->r.bake_filter; a++)
- bake_mask_filter_extend((char *)ibuf->userdata, ibuf->x, ibuf->y);
+ IMB_mask_filter_extend((char *)ibuf->userdata, ibuf->x, ibuf->y);
temprect = MEM_dupallocN(ibuf->userdata);
/* expand twice to clear this many pixels, so they blend back in */
- bake_mask_filter_extend(temprect, ibuf->x, ibuf->y);
- bake_mask_filter_extend(temprect, ibuf->x, ibuf->y);
+ IMB_mask_filter_extend(temprect, ibuf->x, ibuf->y);
+ IMB_mask_filter_extend(temprect, ibuf->x, ibuf->y);
/* clear all pixels in the margin*/
- bake_mask_clear(ibuf, temprect, BAKE_MASK_MARGIN);
+ IMB_mask_clear(ibuf, temprect, FILTER_MASK_MARGIN);
MEM_freeN(temprect);
}