diff options
author | Matt Ebb <matt@mke3.net> | 2010-06-27 09:39:55 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2010-06-27 09:39:55 +0400 |
commit | 03fa4bb9992293b51eb7c24f2c1f810df634e632 (patch) | |
tree | 7dacebe843bf9c041b3ebb220665f428d58e2804 /source/blender/render | |
parent | ea4e5a08cdb782d314cee48dde5dff9331054fe3 (diff) |
Partial cleanup of timing system, with some guidance from Joshua:
* Fractional frames support has been changed to use a new var, scene->r.subframe.
This is a 0.0-1.0 float representing a subframe interval, used in generating a final float
frame number to evaluate animation system etc.
* Changed frame_to_float() and some instances of bsystem_time() into a convenience function:
float BKE_curframe(scene) which retrieves the floating point current frame, after subframe
and frame length corrections.
* Removed blur_offs and field_offs globals. These are now stored in render, used to
generate a scene->r.subframe before render database processing.
Diffstat (limited to 'source/blender/render')
5 files changed, 22 insertions, 13 deletions
diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 2da8570c3a0..331474a85e3 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -189,7 +189,8 @@ struct Render ListBase strandsurface; /* use this instead of R.r.cfra */ - float cfra; + float cfra; + float mblur_offs, field_offs; /* render database */ int totvlak, totvert, tothalo, totstrand, totlamp; diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index deb3d99f9ed..eaef6571c4f 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1520,7 +1520,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem RNG *rng= 0; float loc[3],loc1[3],loc0[3],mat[4][4],nmat[3][3],co[3],nor[3],time; float strandlen=0.0f, curlen=0.0f; - float hasize, pa_size, r_tilt, r_length, cfra=bsystem_time(re->scene, ob, (float)re->scene->r.cfra, 0.0); + float hasize, pa_size, r_tilt, r_length, cfra= BKE_curframe(re->scene); float pa_time, pa_birthtime, pa_dietime; float random, simplify[2]; int i, a, k, max_k=0, totpart, dosimplify = 0, dosurfacecache = 0; @@ -1639,7 +1639,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem if(part->flag & PART_GLOB_TIME) #endif // XXX old animation system - cfra = bsystem_time(re->scene, 0, (float)re->scene->r.cfra, 0.0); + cfra = BKE_curframe(re->scene); ///* 2.4 setup reactors */ // if(part->type == PART_REACTOR){ diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 180f8a960db..722ce55e950 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -1302,6 +1302,8 @@ void RE_InitState(Render *re, Render *source, RenderData *rd, SceneRenderLayer * /* we clip faces with a minimum of 2 pixel boundary outside of image border. see zbuf.c */ re->clipcrop= 1.0f + 2.0f/(float)(re->winx>re->winy?re->winy:re->winx); + re->mblur_offs = re->field_offs = 0.f; + RE_init_threadcount(re); } @@ -1762,6 +1764,7 @@ static void do_render_3d(Render *re) /* internal */ // re->cfra= cfra; /* <- unused! */ + re->scene->r.subframe = re->mblur_offs + re->field_offs; /* make render verts/faces/halos/lamps */ if(render_scene_needs_vector(re)) @@ -1778,6 +1781,8 @@ static void do_render_3d(Render *re) /* free all render verts etc */ RE_Database_Free(re); + + re->scene->r.subframe = 0.f; } /* called by blur loop, accumulate RGBA key alpha */ @@ -1877,7 +1882,7 @@ static void do_render_blur_3d(Render *re) /* do the blur steps */ while(blur--) { - set_mblur_offs( re->r.blurfac*((float)(re->r.mblur_samples-blur))/(float)re->r.mblur_samples ); + re->mblur_offs = re->r.blurfac*((float)(re->r.mblur_samples-blur))/(float)re->r.mblur_samples; re->i.curblur= re->r.mblur_samples-blur; /* stats */ @@ -1895,7 +1900,7 @@ static void do_render_blur_3d(Render *re) re->result= rres; BLI_rw_mutex_unlock(&re->resultmutex); - set_mblur_offs(0.0f); + re->mblur_offs = 0.0f; re->i.curblur= 0; /* stats */ /* weak... the display callback wants an active renderlayer pointer... */ @@ -1975,15 +1980,17 @@ static void do_render_fields_3d(Render *re) re->i.curfield= 2; /* stats */ re->flag |= R_SEC_FIELD; - if((re->r.mode & R_FIELDSTILL)==0) - set_field_offs(0.5f); + if((re->r.mode & R_FIELDSTILL)==0) { + re->field_offs = 0.5f; + } RE_SetCamera(re, re->scene->camera); if(re->r.mode & R_MBLUR) do_render_blur_3d(re); else do_render_3d(re); re->flag &= ~R_SEC_FIELD; - set_field_offs(0.0f); + + re->field_offs = 0.0f; rr2= re->result; } @@ -2448,7 +2455,7 @@ static void do_render_seq(Render * re) if(recurs_depth==0) { /* otherwise sequencer animation isnt updated */ - BKE_animsys_evaluate_all_animation(G.main, (float)cfra); // XXX, was frame_to_float(re->scene, cfra) + BKE_animsys_evaluate_all_animation(G.main, (float)cfra); // XXX, was BKE_curframe(re->scene) } recurs_depth++; @@ -2748,7 +2755,7 @@ void RE_BlenderFrame(Render *re, Scene *scene, SceneRenderLayer *srl, unsigned i MEM_reset_peak_memory(); do_render_all_options(re); } - + /* UGLY WARNING */ G.rendering= 0; } @@ -2946,7 +2953,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int ef mh->end_movie(); scene->r.cfra= cfrao; - + /* UGLY WARNING */ G.rendering= 0; } diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 6ae9038437b..4f86f67f0e3 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -39,6 +39,7 @@ #include "BKE_main.h" #include "BKE_object.h" #include "BKE_particle.h" +#include "BKE_scene.h" #include "BKE_texture.h" #include "DNA_meshdata_types.h" @@ -95,7 +96,7 @@ static void pointdensity_cache_psys(Render *re, PointDensity *pd, Object *ob, Pa ParticleKey state; ParticleSimulationData sim = {re->scene, ob, psys, NULL}; ParticleData *pa=NULL; - float cfra = bsystem_time(re->scene, ob, (float)re->scene->r.cfra, 0.0); + float cfra = BKE_curframe(re->scene); int i, childexists; int total_particles, offset=0; int data_used = point_data_used(pd); diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index 9b087900734..e982c1a12a7 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -98,7 +98,7 @@ void init_render_texture(Render *re, Tex *tex) if(tex->type==TEX_PLUGIN) { if(tex->plugin && tex->plugin->doit) { if(tex->plugin->cfra) { - *(tex->plugin->cfra)= (float)cfra; //frame_to_float(re->scene, cfra); // XXX old animsys - timing stuff to be fixed + *(tex->plugin->cfra)= (float)cfra; //BKE_curframe(re->scene); // XXX old animsys - timing stuff to be fixed } } } |