X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Fsrc%2Fsynfig%2Flayer_motionblur.cpp;h=61fa152028c0174f6ec44146105e2ac8d624d4b9;hb=d43ed398fd84b93b96eb91d91dafdf65c80537e6;hp=59f90f7a145fbf6240c687572ff07f7a9ec8ba8b;hpb=adfc80c126f482d7ea2bac38001a2c4a7c7df88c;p=synfig.git diff --git a/synfig-core/src/synfig/layer_motionblur.cpp b/synfig-core/src/synfig/layer_motionblur.cpp index 59f90f7..61fa152 100644 --- a/synfig-core/src/synfig/layer_motionblur.cpp +++ b/synfig-core/src/synfig/layer_motionblur.cpp @@ -61,9 +61,15 @@ SYNFIG_LAYER_SET_CVS_ID(Layer_MotionBlur,"$Id$"); /* === M E M B E R S ======================================================= */ Layer_MotionBlur::Layer_MotionBlur(): - Layer_Composite (1.0,Color::BLEND_STRAIGHT), - aperture (0) + Layer_Composite (1.0,Color::BLEND_STRAIGHT), + aperture (0), + subsamples_factor (1.0), + subsampling_type (SUBSAMPLING_HYPERBOLIC), + subsample_start (0.0), + subsample_end (1.0) { + Layer::Vocab voc(get_param_vocab()); + Layer::fill_static(voc); } bool @@ -71,13 +77,21 @@ Layer_MotionBlur::set_param(const String ¶m, const ValueBase &value) { IMPORT(aperture); + IMPORT(subsamples_factor); + IMPORT(subsampling_type); + IMPORT(subsample_start); + IMPORT(subsample_end); return Layer_Composite::set_param(param,value); } ValueBase Layer_MotionBlur::get_param(const String ¶m)const { - EXPORT(aperture); + EXPORT(aperture); + EXPORT(subsamples_factor); + EXPORT(subsampling_type); + EXPORT(subsample_start); + EXPORT(subsample_end); EXPORT_NAME(); EXPORT_VERSION(); @@ -123,6 +137,30 @@ Layer_MotionBlur::get_param_vocab()const .set_description(_("Shutter Time")) ); + ret.push_back(ParamDesc("subsamples_factor") + .set_local_name(_("Subsamples Factor")) + .set_description(_("Multiplies The Number Of Subsamples Rendered")) + ); + + ret.push_back(ParamDesc("subsampling_type") + .set_local_name(_("Subsampling Type")) + .set_description(_("Curve Type For Weighting Subsamples")) + .set_hint("enum") + .add_enum_value(SUBSAMPLING_CONSTANT,"constant",_("Constant")) + .add_enum_value(SUBSAMPLING_LINEAR,"linear",_("Linear")) + .add_enum_value(SUBSAMPLING_HYPERBOLIC,"hyperbolic",_("Hyperbolic")) + ); + + ret.push_back(ParamDesc("subsample_start") + .set_local_name(_("Subsample Start Amount")) + .set_description(_("Relative Amount Of The First Subsample, For Linear Weighting")) + ); + + ret.push_back(ParamDesc("subsample_end") + .set_local_name(_("Subsample End Amount")) + .set_description(_("Relative Amount Of The Last Subsample, For Linear Weighting")) + ); + return ret; } @@ -170,7 +208,17 @@ Layer_MotionBlur::accelerated_render(Context context,Surface *surface,int qualit } - if (samples == 1) return context.accelerated_render(surface,quality,renddesc,cb); + samples *= subsamples_factor; + + if (samples <= 1) return context.accelerated_render(surface,quality,renddesc,cb); + + // Only in modes where subsample_start/end matters... + if(subsampling_type == SUBSAMPLING_LINEAR) + { + // We won't render when the scale==0, so we'll use those samples elsewhere + if(subsample_start == 0) samples++; + if(subsample_end == 0) samples++; + } Surface tmp; int i; @@ -179,14 +227,32 @@ Layer_MotionBlur::accelerated_render(Context context,Surface *surface,int qualit surface->set_wh(renddesc.get_w(),renddesc.get_h()); surface->clear(); + // Render subsamples from time_cur-aperture to time_cur for(i=0;i