improved corner pin

This commit is contained in:
itsmattkc
2018-11-12 18:44:10 +11:00
parent 398e1aef43
commit 18c112d83e
9 changed files with 78 additions and 19 deletions
+1 -4
View File
@@ -20,6 +20,7 @@
#include "debug.h"
#include "io/path.h"
#include "mainwindow.h"
#include "io/math.h"
#include "effects/internal/transformeffect.h"
#include "effects/internal/texteffect.h"
@@ -228,10 +229,6 @@ void EffectInit::run() {
dout << "[INFO] Finished initializing effects";
}
double double_lerp(double a, double b, double t) {
return ((1.0 - t) * a) + (t * b);
}
Effect::Effect(Clip* c, const EffectMeta *em) :
parent_clip(c),
meta(em),
+2
View File
@@ -84,6 +84,8 @@ extern QMutex effects_loaded;
#define TRAN_TYPE_CLOSEWLINK 4
struct GLTextureCoords {
int grid_size;
int vertexTopLeftX;
int vertexTopLeftY;
int vertexTopRightX;
+10
View File
@@ -5,19 +5,27 @@ CornerPinEffect::CornerPinEffect(Clip *c, const EffectMeta *em) : Effect(c, em)
EffectRow* top_left = add_row("Top Left:");
top_left_x = top_left->add_field(EFFECT_FIELD_DOUBLE);
top_left_x->id = "topleftx";
top_left_y = top_left->add_field(EFFECT_FIELD_DOUBLE);
top_left_y->id = "toplefty";
EffectRow* top_right = add_row("Top Right:");
top_right_x = top_right->add_field(EFFECT_FIELD_DOUBLE);
top_right_x->id = "toprightx";
top_right_y = top_right->add_field(EFFECT_FIELD_DOUBLE);
top_right_y->id = "toprighty";
EffectRow* bottom_left = add_row("Bottom Left:");
bottom_left_x = bottom_left->add_field(EFFECT_FIELD_DOUBLE);
bottom_left_x->id = "bottomleftx";
bottom_left_y = bottom_left->add_field(EFFECT_FIELD_DOUBLE);
bottom_left_y->id = "bottomlefty";
EffectRow* bottom_right = add_row("Bottom Right:");
bottom_right_x = bottom_right->add_field(EFFECT_FIELD_DOUBLE);
bottom_right_x->id = "bottomrightx";
bottom_right_y = bottom_right->add_field(EFFECT_FIELD_DOUBLE);
bottom_right_y->id = "bottomrighty";
connect(top_left_x, SIGNAL(changed()), this, SLOT(field_changed()));
connect(top_left_y, SIGNAL(changed()), this, SLOT(field_changed()));
@@ -30,6 +38,8 @@ CornerPinEffect::CornerPinEffect(Clip *c, const EffectMeta *em) : Effect(c, em)
}
void CornerPinEffect::process_coords(double timecode, GLTextureCoords &coords) {
coords.grid_size += 4;
coords.vertexTopLeftX += top_left_x->get_double_value(timecode);
coords.vertexTopLeftY += top_left_y->get_double_value(timecode);