forked from bartvdbraak/blender
fix for re->partx/re->party values being different for RE_Database_FromScene() then the main render loop.
This commit is contained in:
parent
7ea3c5ed6d
commit
6033127324
@ -40,8 +40,9 @@ struct Object;
|
||||
void free_sample_tables(Render *re);
|
||||
void make_sample_tables(Render *re);
|
||||
|
||||
void initparts(Render *re, int do_crop);
|
||||
void freeparts(Render *re);
|
||||
void RE_parts_clamp(Render *re);
|
||||
void RE_parts_init(Render *re, int do_crop);
|
||||
void RE_parts_free(Render *re);
|
||||
|
||||
|
||||
#endif /* __INITRENDER_H__ */
|
||||
|
@ -376,7 +376,7 @@ int RE_engine_render(Render *re, int do_all)
|
||||
if ((re->r.scemode & (R_NO_FRAME_UPDATE | R_PREVIEWBUTS)) == 0)
|
||||
BKE_scene_update_for_newframe(re->main, re->scene, re->lay);
|
||||
|
||||
initparts(re, FALSE);
|
||||
RE_parts_init(re, FALSE);
|
||||
engine->tile_x = re->partx;
|
||||
engine->tile_y = re->party;
|
||||
|
||||
@ -407,7 +407,7 @@ int RE_engine_render(Render *re, int do_all)
|
||||
BLI_rw_mutex_unlock(&re->resultmutex);
|
||||
}
|
||||
|
||||
freeparts(re);
|
||||
RE_parts_free(re);
|
||||
|
||||
if (BKE_reports_contain(re->reports, RPT_ERROR))
|
||||
G.is_break = TRUE;
|
||||
|
@ -525,7 +525,7 @@ void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, flo
|
||||
/* ~~~~~~~~~~~~~~~~ part (tile) calculus ~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
|
||||
void freeparts(Render *re)
|
||||
void RE_parts_free(Render *re)
|
||||
{
|
||||
RenderPart *part = re->parts.first;
|
||||
|
||||
@ -537,12 +537,19 @@ void freeparts(Render *re)
|
||||
BLI_freelistN(&re->parts);
|
||||
}
|
||||
|
||||
void initparts(Render *re, int do_crop)
|
||||
void RE_parts_clamp(Render *re)
|
||||
{
|
||||
/* part size */
|
||||
re->partx = min_ii(re->r.tilex, re->rectx);
|
||||
re->party = min_ii(re->r.tiley, re->recty);
|
||||
}
|
||||
|
||||
void RE_parts_init(Render *re, int do_crop)
|
||||
{
|
||||
int nr, xd, yd, partx, party, xparts, yparts;
|
||||
int xminb, xmaxb, yminb, ymaxb;
|
||||
|
||||
freeparts(re);
|
||||
RE_parts_free(re);
|
||||
|
||||
/* this is render info for caller, is not reset when parts are freed! */
|
||||
re->i.totpart = 0;
|
||||
@ -555,13 +562,10 @@ void initparts(Render *re, int do_crop)
|
||||
xmaxb = re->disprect.xmax;
|
||||
ymaxb = re->disprect.ymax;
|
||||
|
||||
/* part size */
|
||||
partx = min_ii(re->r.tilex, re->rectx);
|
||||
party = min_ii(re->r.tiley, re->recty);
|
||||
|
||||
re->partx = partx;
|
||||
re->party = party;
|
||||
|
||||
RE_parts_clamp(re);
|
||||
|
||||
partx = re->partx;
|
||||
party = re->party;
|
||||
/* part count */
|
||||
xparts = (re->rectx + partx - 1) / partx;
|
||||
yparts = (re->recty + party - 1) / party;
|
||||
|
@ -693,7 +693,7 @@ static void *do_part_thread(void *pa_v)
|
||||
|
||||
/* calculus for how much 1 pixel rendered should rotate the 3d geometry */
|
||||
/* is not that simple, needs to be corrected for errors of larger viewplane sizes */
|
||||
/* called in initrender.c, initparts() and convertblender.c, for speedvectors */
|
||||
/* called in initrender.c, RE_parts_init() and convertblender.c, for speedvectors */
|
||||
float panorama_pixel_rot(Render *re)
|
||||
{
|
||||
float psize, phi, xfac;
|
||||
@ -836,7 +836,7 @@ static void threaded_tile_processor(Render *re)
|
||||
|
||||
/* warning; no return here without closing exr file */
|
||||
|
||||
initparts(re, TRUE);
|
||||
RE_parts_init(re, TRUE);
|
||||
|
||||
if (re->result->do_exr_tile)
|
||||
render_result_exr_file_begin(re);
|
||||
@ -928,7 +928,7 @@ static void threaded_tile_processor(Render *re)
|
||||
g_break = 0;
|
||||
|
||||
BLI_end_threads(&threads);
|
||||
freeparts(re);
|
||||
RE_parts_free(re);
|
||||
re->viewplane = viewplane; /* restore viewplane, modified by pano render */
|
||||
}
|
||||
|
||||
@ -947,6 +947,7 @@ static void do_render_3d(Render *re)
|
||||
return;
|
||||
|
||||
/* internal */
|
||||
RE_parts_clamp(re);
|
||||
|
||||
// re->cfra= cfra; /* <- unused! */
|
||||
re->scene->r.subframe = re->mblur_offs + re->field_offs;
|
||||
|
@ -1179,30 +1179,36 @@ HaloRen *RE_inithalo_particle(Render *re, ObjectRen *obr, DerivedMesh *dm, Mater
|
||||
/* -------------------------- operations on entire database ----------------------- */
|
||||
|
||||
/* ugly function for halos in panorama */
|
||||
static int panotestclip(Render *re, int do_pano, float *v)
|
||||
static int panotestclip(Render *re, int do_pano, float v[4])
|
||||
{
|
||||
/* to be used for halos en infos */
|
||||
float abs4;
|
||||
short c=0;
|
||||
int xparts = (re->rectx + re->partx - 1) / re->partx;
|
||||
/* part size (ensure we run RE_parts_clamp first) */
|
||||
BLI_assert(re->partx == min_ii(re->r.tilex, re->rectx));
|
||||
BLI_assert(re->party == min_ii(re->r.tiley, re->recty));
|
||||
|
||||
if (do_pano == FALSE) {
|
||||
return testclip(v);
|
||||
}
|
||||
else {
|
||||
/* to be used for halos en infos */
|
||||
float abs4;
|
||||
short c = 0;
|
||||
|
||||
abs4= fabs(v[3]);
|
||||
int xparts = (re->rectx + re->partx - 1) / re->partx;
|
||||
|
||||
if (v[2]< -abs4) c=16; /* this used to be " if (v[2]<0) ", see clippz() */
|
||||
else if (v[2]> abs4) c+= 32;
|
||||
abs4= fabsf(v[3]);
|
||||
|
||||
if ( v[1]>abs4) c+=4;
|
||||
else if ( v[1]< -abs4) c+=8;
|
||||
if (v[2]< -abs4) c=16; /* this used to be " if (v[2]<0) ", see clippz() */
|
||||
else if (v[2]> abs4) c+= 32;
|
||||
|
||||
abs4*= xparts;
|
||||
if ( v[0]>abs4) c+=2;
|
||||
else if ( v[0]< -abs4) c+=1;
|
||||
if ( v[1]>abs4) c+=4;
|
||||
else if ( v[1]< -abs4) c+=8;
|
||||
|
||||
return c;
|
||||
abs4*= xparts;
|
||||
if ( v[0]>abs4) c+=2;
|
||||
else if ( v[0]< -abs4) c+=1;
|
||||
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user