when setting the subframe for large frames (250,000+) the precision was very poor.
now use double precision when combining the frame+subframe.
This commit is contained in:
parent
d63045d977
commit
94cb20ff4e
|
@ -99,6 +99,7 @@ int BKE_scene_validate_setscene(struct Main *bmain, struct Scene *sce);
|
|||
|
||||
float BKE_scene_frame_get(struct Scene *scene);
|
||||
float BKE_scene_frame_get_from_ctime(struct Scene *scene, const float frame);
|
||||
void BKE_scene_frame_set(struct Scene *scene, double cfra);
|
||||
|
||||
void BKE_scene_update_tagged(struct Main *bmain, struct Scene *sce);
|
||||
|
||||
|
|
|
@ -1045,6 +1045,21 @@ float BKE_scene_frame_get_from_ctime(Scene *scene, const float frame)
|
|||
return ctime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the frame int/float components.
|
||||
*/
|
||||
void BKE_scene_frame_set(struct Scene *scene, double cfra)
|
||||
{
|
||||
double intpart;
|
||||
scene->r.subframe = modf(cfra, &intpart);
|
||||
scene->r.cfra = (int)intpart;
|
||||
|
||||
if (cfra < 0.0) {
|
||||
scene->r.cfra -= 1;
|
||||
scene->r.subframe = 1.0f + scene->r.subframe;
|
||||
}
|
||||
}
|
||||
|
||||
/* drivers support/hacks
|
||||
* - this method is called from scene_update_tagged_recursive(), so gets included in viewport + render
|
||||
* - these are always run since the depsgraph can't handle non-object data
|
||||
|
|
|
@ -56,12 +56,11 @@
|
|||
|
||||
static void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
|
||||
{
|
||||
float cfra = (float)frame + subframe;
|
||||
double cfra = (double)frame + (double)subframe;
|
||||
|
||||
CLAMP(cfra, MINAFRAME, MAXFRAME);
|
||||
BKE_scene_frame_set(scene, cfra);
|
||||
|
||||
scene->r.cfra = floorf(cfra);
|
||||
scene->r.subframe = cfra - floorf(cfra);
|
||||
|
||||
CLAMP(scene->r.cfra, MINAFRAME, MAXFRAME);
|
||||
BKE_scene_update_for_newframe(G.main, scene, (1 << 20) - 1);
|
||||
BKE_scene_camera_switch_update(scene);
|
||||
|
||||
|
|
|
@ -1113,7 +1113,6 @@ void RE_TileProcessor(Render *re)
|
|||
|
||||
static void do_render_3d(Render *re)
|
||||
{
|
||||
float cfra;
|
||||
int cfra_backup;
|
||||
|
||||
/* try external */
|
||||
|
@ -1126,9 +1125,7 @@ static void do_render_3d(Render *re)
|
|||
/* add motion blur and fields offset to frames */
|
||||
cfra_backup = re->scene->r.cfra;
|
||||
|
||||
cfra = re->scene->r.cfra + re->mblur_offs + re->field_offs;
|
||||
re->scene->r.cfra = floorf(cfra);
|
||||
re->scene->r.subframe = cfra - floorf(cfra);
|
||||
BKE_scene_frame_set(re->scene, (double)re->scene->r.cfra + (double)re->mblur_offs + (double)re->field_offs);
|
||||
|
||||
/* lock drawing in UI during data phase */
|
||||
if (re->draw_lock)
|
||||
|
|
Loading…
Reference in New Issue