Merged changes in the trunk up to revision 49797.

This commit is contained in:
2012-08-12 00:09:57 +00:00
649 changed files with 8918 additions and 20075 deletions

View File

@@ -233,7 +233,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
obr= RE_addRenderObject(re, NULL, NULL, 0, 0, 0);
for (x = sx, fx = sx * stargrid; x <= ex; x++, fx += stargrid) {
for (y = sy, fy = sy * stargrid; y <= ey ; y++, fy += stargrid) {
for (y = sy, fy = sy * stargrid; y <= ey; y++, fy += stargrid) {
for (z = sz, fz = sz * stargrid; z <= ez; z++, fz += stargrid) {
BLI_srand((hash[z & 0xff] << 24) + (hash[y & 0xff] << 16) + (hash[x & 0xff] << 8));
@@ -310,7 +310,7 @@ void RE_make_stars(Render *re, Scene *scenev3d, void (*initfunc)(void),
totstar++;
}
/* do not call blender_test_break() here, since it is used in UI as well, confusing the callback system */
/* main cause is G.afbreek of course, a global again... (ton) */
/* main cause is G.is_break of course, a global again... (ton) */
}
}
if (termfunc) termfunc();
@@ -1614,7 +1614,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
if (part->type==PART_HAIR && !psys->childcache)
totchild= 0;
if (G.rendering == 0) { /* preview render */
if (G.is_rendering == FALSE) { /* preview render */
totchild = (int)((float)totchild * (float)part->disp / 100.0f);
}
@@ -3919,7 +3919,7 @@ static GroupObject *add_render_lamp(Render *re, Object *ob)
if (la->mtex[c]->mapto & LAMAP_SHAD)
lar->mode |= LA_SHAD_TEX;
if (G.rendering) {
if (G.is_rendering) {
if (re->osa) {
if (la->mtex[c]->tex->type==TEX_IMAGE) lar->mode |= LA_OSATEX;
}
@@ -4710,7 +4710,7 @@ void RE_Database_Free(Render *re)
LampRen *lar;
/* statistics for debugging render memory usage */
if ((G.debug & G_DEBUG) && (G.rendering)) {
if ((G.debug & G_DEBUG) && (G.is_rendering)) {
if ((re->r.scemode & R_PREVIEWBUTS)==0) {
BKE_image_print_memlist();
MEM_printmemlist_stats();

View File

@@ -476,7 +476,7 @@ static void render_envmap(Render *re, EnvMap *env)
ibuf->profile = IB_PROFILE_LINEAR_RGB;
/* envmap renders without alpha */
alpha = ((float *)ibuf->rect_float) + 3;
alpha = ibuf->rect_float + 3;
for (y = ibuf->x * ibuf->y - 1; y >= 0; y--, alpha += 4)
*alpha = 1.0;

View File

@@ -331,7 +331,7 @@ int RE_engine_render(Render *re, int do_all)
RE_engine_free(engine);
if (BKE_reports_contain(re->reports, RPT_ERROR))
G.afbreek = 1;
G.is_break = TRUE;
return 1;
}

View File

@@ -1779,11 +1779,8 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
}
/* de-premul, this is being premulled in shade_input_do_shade() */
if (texres->ta!=1.0f && texres->ta>1e-4f) {
fx= 1.0f/texres->ta;
texres->tr*= fx;
texres->tg*= fx;
texres->tb*= fx;
if (texres->ta != 1.0f && texres->ta > 1e-4f) {
mul_v3_fl(&texres->tr, 1.0f / texres->ta);
}
BRICONTRGB;
@@ -1791,25 +1788,22 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
return retval;
}
void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *result)
void image_sample(Image *ima, float fx, float fy, float dx, float dy, float result[4])
{
TexResult texres;
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
if (ibuf==NULL) {
result[0]= result[1]= result[2]= result[3]= 0.0f;
if (UNLIKELY(ibuf == NULL)) {
zero_v4(result);
return;
}
if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
ibuf->rect+= (ibuf->x*ibuf->y);
texres.talpha= 1; /* boxsample expects to be initialized */
boxsample(ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 1);
result[0]= texres.tr;
result[1]= texres.tg;
result[2]= texres.tb;
result[3]= texres.ta;
texres.talpha = TRUE; /* boxsample expects to be initialized */
boxsample(ibuf, fx, fy, fx + dx, fy + dy, &texres, 0, 1);
copy_v4_v4(result, &texres.tr);
if ( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) )
ibuf->rect-= (ibuf->x*ibuf->y);
@@ -1817,15 +1811,11 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
ima->flag|= IMA_USED_FOR_RENDER;
}
void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *result)
void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float result[4])
{
TexResult texres;
TexResult texres = {0};
afdata_t AFD;
if (ibuf==NULL) {
return;
}
AFD.dxt[0] = dx; AFD.dxt[1] = dx;
AFD.dyt[0] = dy; AFD.dyt[1] = dy;
//copy_v2_v2(AFD.dxt, dx);
@@ -1833,13 +1823,8 @@ void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *res
AFD.intpol = 1;
AFD.extflag = TXC_EXTD;
memset(&texres, 0, sizeof(texres));
ewa_eval(&texres, ibuf, fx, fy, &AFD);
result[0]= texres.tr;
result[1]= texres.tg;
result[2]= texres.tb;
result[3]= texres.ta;
copy_v4_v4(result, &texres.tr);
}

View File

@@ -141,7 +141,7 @@ static void result_nothing(void *UNUSED(arg), RenderResult *UNUSED(rr)) {}
static void result_rcti_nothing(void *UNUSED(arg), RenderResult *UNUSED(rr), volatile struct rcti *UNUSED(rect)) {}
static void stats_nothing(void *UNUSED(arg), RenderStats *UNUSED(rs)) {}
static void float_nothing(void *UNUSED(arg), float UNUSED(val)) {}
static int default_break(void *UNUSED(arg)) {return G.afbreek == 1;}
static int default_break(void *UNUSED(arg)) { return G.is_break == TRUE; }
static void stats_background(void *UNUSED(arg), RenderStats *rs)
{
@@ -1209,7 +1209,7 @@ static void do_render_fields_blur_3d(Render *re)
/* also check for camera here */
if (camera == NULL) {
printf("ERROR: Cannot render, no camera\n");
G.afbreek = 1;
G.is_break = TRUE;
return;
}
@@ -1574,7 +1574,7 @@ void RE_MergeFullSample(Render *re, Main *bmain, Scene *sce, bNodeTree *ntree)
bNode *node;
/* default start situation */
G.afbreek = 0;
G.is_break = FALSE;
re->main = bmain;
re->scene = sce;
@@ -1744,17 +1744,17 @@ static void do_render_seq(Render *re)
if ((re->r.mode & R_BORDER) && (re->r.mode & R_CROP) == 0) {
/* if border rendering is used and cropping is disabled, final buffer should
* be as large as the whole frame */
context = seq_new_render_data(re->main, re->scene,
context = BKE_sequencer_new_render_data(re->main, re->scene,
re->winx, re->winy,
100);
}
else {
context = seq_new_render_data(re->main, re->scene,
context = BKE_sequencer_new_render_data(re->main, re->scene,
re->result->rectx, re->result->recty,
100);
}
ibuf = give_ibuf_seq(context, cfra, 0);
ibuf = BKE_sequencer_give_ibuf(context, cfra, 0);
recurs_depth--;
@@ -1769,7 +1769,7 @@ static void do_render_seq(Render *re)
if (recurs_depth == 0) { /* with nested scenes, only free on toplevel... */
Editing *ed = re->scene->ed;
if (ed)
free_imbuf_seq(re->scene, &ed->seqbase, TRUE, TRUE);
BKE_sequencer_free_imbuf(re->scene, &ed->seqbase, TRUE, TRUE);
}
IMB_freeImBuf(ibuf);
}
@@ -1896,8 +1896,11 @@ static int node_tree_has_composite_output(bNodeTree *ntree)
return TRUE;
}
else if (node->type == NODE_GROUP) {
if (node_tree_has_composite_output((bNodeTree *)node->id))
return TRUE;
if (node->id) {
if (node_tree_has_composite_output((bNodeTree *)node->id)) {
return TRUE;
}
}
}
}
@@ -2112,7 +2115,7 @@ void RE_SetReports(Render *re, ReportList *reports)
void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, Object *camera_override, unsigned int lay, int frame, const short write_still)
{
/* ugly global still... is to prevent preview events and signal subsurfs etc to make full resol */
G.rendering = 1;
G.is_rendering = TRUE;
scene->r.cfra = frame;
@@ -2123,7 +2126,7 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
do_render_all_options(re);
if (write_still && !G.afbreek) {
if (write_still && !G.is_break) {
if (BKE_imtype_is_movie(scene->r.im_format.imtype)) {
/* operator checks this but in case its called from elsewhere */
printf("Error: cant write single images with a movie format!\n");
@@ -2140,10 +2143,10 @@ void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *sr
BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
}
BLI_callback_exec(re->main, (ID *)scene, G.afbreek ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE);
BLI_callback_exec(re->main, (ID *)scene, G.is_break ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE);
/* UGLY WARNING */
G.rendering = 0;
G.is_rendering = FALSE;
}
void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene)
@@ -2248,16 +2251,16 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
/* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */
/* is also set by caller renderwin.c */
G.rendering = 1;
G.is_rendering = TRUE;
re->flag |= R_ANIMATION;
if (BKE_imtype_is_movie(scene->r.im_format.imtype))
if (!mh->start_movie(scene, &re->r, re->rectx, re->recty, re->reports))
G.afbreek = 1;
G.is_break = TRUE;
if (mh->get_next_frame) {
while (!(G.afbreek == 1)) {
while (!(G.is_break == 1)) {
int nf = mh->get_next_frame(&re->r, re->reports);
if (nf >= 0 && nf >= scene->r.sfra && nf <= scene->r.efra) {
scene->r.cfra = re->r.cfra = nf;
@@ -2269,16 +2272,17 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
if (re->test_break(re->tbh) == 0) {
if (!do_write_image_or_movie(re, bmain, scene, mh, NULL))
G.afbreek = 1;
G.is_break = TRUE;
}
if (G.afbreek == 0) {
if (G.is_break == FALSE) {
BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
}
}
else {
if (re->test_break(re->tbh))
G.afbreek = 1;
if (re->test_break(re->tbh)) {
G.is_break = TRUE;
}
}
}
}
@@ -2334,14 +2338,14 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
totrendered++;
if (re->test_break(re->tbh) == 0) {
if (!G.afbreek)
if (!G.is_break)
if (!do_write_image_or_movie(re, bmain, scene, mh, NULL))
G.afbreek = 1;
G.is_break = TRUE;
}
else
G.afbreek = 1;
G.is_break = TRUE;
if (G.afbreek == 1) {
if (G.is_break == TRUE) {
/* remove touched file */
if (BKE_imtype_is_movie(scene->r.im_format.imtype) == 0) {
if (scene->r.mode & R_TOUCH && BLI_exists(name) && BLI_file_size(name) == 0) {
@@ -2352,7 +2356,7 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
break;
}
if (G.afbreek == 0) {
if (G.is_break == FALSE) {
BLI_callback_exec(re->main, (ID *)scene, BLI_CB_EVT_RENDER_POST); /* keep after file save */
}
}
@@ -2369,10 +2373,10 @@ void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, Object *camera_overri
re->flag &= ~R_ANIMATION;
BLI_callback_exec(re->main, (ID *)scene, G.afbreek ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE);
BLI_callback_exec(re->main, (ID *)scene, G.is_break ? BLI_CB_EVT_RENDER_CANCEL : BLI_CB_EVT_RENDER_COMPLETE);
/* UGLY WARNING */
G.rendering = 0;
G.is_rendering = FALSE;
}
void RE_PreviewRender(Render *re, Main *bmain, Scene *sce)

View File

@@ -112,7 +112,7 @@ static void init_render_texture(Render *re, Tex *tex)
tex->extend= TEX_EXTEND;
/* only free envmap when rendermode was set to render envmaps, for previewrender */
if (G.rendering && re) {
if (G.is_rendering && re) {
if (re->r.mode & R_ENVMAP)
if (tex->env->stype==ENV_ANIM)
BKE_free_envmapdata(tex->env);

View File

@@ -848,7 +848,7 @@ void threaded_makeshadowbufs(Render *re)
int (*test_break)(void *);
/* count number of threads to use */
if (G.rendering) {
if (G.is_rendering) {
for (lar=re->lampren.first; lar; lar= lar->next)
if (lar->shb)
totthread++;

View File

@@ -88,7 +88,7 @@ int ocean_texture(Tex *tex, float *texvec, TexResult *texres)
}
else { /* non-cached */
if (G.rendering)
if (G.is_rendering)
BKE_ocean_eval_uv_catrom(omd->ocean, &ocr, u, v);
else
BKE_ocean_eval_uv(omd->ocean, &ocr, u, v);

View File

@@ -3975,9 +3975,9 @@ unsigned short *zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pas
if (R.test_break(R.tbh))
return NULL;
if (R.osa>16) { /* MAX_OSA */
if (R.osa > 16) { /* MAX_OSA */
printf("zbuffer_transp_shade: osa too large\n");
G.afbreek= 1;
G.is_break = TRUE;
return NULL;
}