diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-11-12 04:30:55 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-11-12 04:30:55 +0400 |
commit | 7fa096261a22afcfb317bcb57ea17aa109f1564d (patch) | |
tree | 8d51f5be097efbfbcec0155db8a6fa8882387aff /source/blender/render | |
parent | a8a2782d34fd09a35598c2653a8225942c4c2ca0 (diff) | |
parent | fbc1cc712f281e1cf61f40d70f09f8479506e018 (diff) |
Merged changes in the trunk up to revision 52118.
Conflicts resolved:
source/blender/makesrna/intern/rna_scene.c
Diffstat (limited to 'source/blender/render')
6 files changed, 38 insertions, 7 deletions
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index f5c77d49c21..9d1e2b8e620 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -170,6 +170,8 @@ void RE_FreeRender (struct Render *re); void RE_FreeAllRender (void); /* only call on file load */ void RE_FreeAllRenderResults(void); +/* for external render engines that can keep persistent data */ +void RE_FreePersistentData(void); /* get results and statistics */ void RE_FreeRenderResult(struct RenderResult *rr); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 7f785eb3d8b..f7a5a930ac6 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -59,6 +59,7 @@ struct RenderBuckets; struct ObjectInstanceRen; struct RayObject; struct RayFace; +struct RenderEngine; struct ReportList; struct Main; @@ -183,6 +184,9 @@ struct Render ListBase parts; + /* render engine */ + struct RenderEngine *engine; + /* octree tables and variables for raytrace */ struct RayObject *raytree; struct RayFace *rayfaces; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index bb7c1bdf94b..47bff762d13 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -4561,7 +4561,7 @@ static void add_render_object(Render *re, Object *ob, Object *par, DupliObject * ParticleSystem *psys; int show_emitter, allow_render= 1, index, psysindex, i; - index= (dob)? dob->index: 0; + index= (dob)? dob->persistent_id[0]: 0; /* the emitter has to be processed first (render levels of modifiers) */ /* so here we only check if the emitter should be rendered */ @@ -4960,7 +4960,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp if (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, 0))) { mult_m4_m4m4(mat, re->viewmat, dob->mat); /* ob = particle system, use that layer */ - obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, 0, mat, ob->lay); + obi= RE_addRenderInstance(re, NULL, obd, ob, dob->persistent_id[0], 0, mat, ob->lay); /* fill in instance variables for texturing */ set_dupli_tex_mat(re, obi, dob); @@ -4987,7 +4987,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp if (dob->type != OB_DUPLIGROUP || (obr=find_dupligroup_dupli(re, obd, psysindex))) { if (obi == NULL) mult_m4_m4m4(mat, re->viewmat, dob->mat); - obi= RE_addRenderInstance(re, NULL, obd, ob, dob->index, psysindex++, mat, obd->lay); + obi= RE_addRenderInstance(re, NULL, obd, ob, dob->persistent_id[0], psysindex++, mat, obd->lay); set_dupli_tex_mat(re, obi, dob); if (dob->type != OB_DUPLIGROUP) { diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index e2f347c05f1..8bdb805ada2 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -349,7 +349,12 @@ int RE_engine_render(Render *re, int do_all) re->i.totface = re->i.totvert = re->i.totstrand = re->i.totlamp = re->i.tothalo = 0; /* render */ - engine = RE_engine_create(type); + if (!re->engine) + re->engine = RE_engine_create(type); + + engine = re->engine; + + /* TODO: actually link to a parent which shouldn't happen */ engine->re = re; if (re->flag & R_ANIMATION) @@ -377,6 +382,11 @@ int RE_engine_render(Render *re, int do_all) if (type->render) type->render(engine, re->scene); + if (!(re->r.mode & R_PERSISTENT_DATA)) { + RE_engine_free(re->engine); + re->engine = NULL; + } + if (re->result->do_exr_tile) { BLI_rw_mutex_lock(&re->resultmutex, THREAD_LOCK_WRITE); render_result_exr_file_end(re); @@ -389,8 +399,6 @@ int RE_engine_render(Render *re, int do_all) render_result_free_list(&engine->fullresult, engine->fullresult.first); - RE_engine_free(engine); - if (BKE_reports_contain(re->reports, RPT_ERROR)) G.is_break = TRUE; diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 9dab18b3c2c..aab7f442249 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -247,6 +247,7 @@ Render *RE_GetRender(const char *name) return re; } + /* if you want to know exactly what has been done */ RenderResult *RE_AcquireResultRead(Render *re) { @@ -390,6 +391,9 @@ void RE_InitRenderCB(Render *re) /* only call this while you know it will remove the link too */ void RE_FreeRender(Render *re) { + if (re->engine) + RE_engine_free(re->engine); + BLI_rw_mutex_end(&re->resultmutex); free_renderdata_tables(re); @@ -424,6 +428,19 @@ void RE_FreeAllRenderResults(void) } } +void RE_FreePersistentData(void) +{ + Render *re; + + /* render engines can be kept around for quick re-render, this clears all */ + for (re = RenderGlobal.renderlist.first; re; re = re->next) { + if (re->engine) { + RE_engine_free(re->engine); + re->engine = NULL; + } + } +} + /* ********* initialize state ******** */ diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index b486407c61c..42849a01971 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -265,7 +265,7 @@ static void init_frame_smoke(VoxelData *vd, float cfra) /* map velocities between 0 and 0.3f */ for (i = 0; i < totRes; i++) { - vd->dataset[i] = sqrt(xvel[i] * xvel[i] + yvel[i] * yvel[i] + zvel[i] * zvel[i]) * 3.0f; + vd->dataset[i] = sqrtf(xvel[i] * xvel[i] + yvel[i] * yvel[i] + zvel[i] * zvel[i]) * 3.0f; } } |