added corner pin effect

This commit is contained in:
itsmattkc
2018-11-12 10:02:00 +11:00
parent b54c44c6b8
commit 660b1d7547
3 changed files with 65 additions and 2 deletions
+39
View File
@@ -0,0 +1,39 @@
#include "cornerpineffect.h"
CornerPinEffect::CornerPinEffect(Clip *c, const EffectMeta *em) : Effect(c, em) {
enable_coords = true;
EffectRow* top_left = add_row("Top Left:");
top_left_x = top_left->add_field(EFFECT_FIELD_DOUBLE);
top_left_y = top_left->add_field(EFFECT_FIELD_DOUBLE);
EffectRow* top_right = add_row("Top Right:");
top_right_x = top_right->add_field(EFFECT_FIELD_DOUBLE);
top_right_y = top_right->add_field(EFFECT_FIELD_DOUBLE);
EffectRow* bottom_left = add_row("Bottom Left:");
bottom_left_x = bottom_left->add_field(EFFECT_FIELD_DOUBLE);
bottom_left_y = bottom_left->add_field(EFFECT_FIELD_DOUBLE);
EffectRow* bottom_right = add_row("Bottom Right:");
bottom_right_x = bottom_right->add_field(EFFECT_FIELD_DOUBLE);
bottom_right_y = bottom_right->add_field(EFFECT_FIELD_DOUBLE);
connect(intensity_val, SIGNAL(changed()), this, SLOT(field_changed()));
connect(rotation_val, SIGNAL(changed()), this, SLOT(field_changed()));
connect(frequency_val, SIGNAL(changed()), this, SLOT(field_changed()));
}
void CornerPinEffect::process_coords(double timecode, GLTextureCoords &coords) {
coords.vertexTopLeftX += top_left_x->get_double_value(timecode);
coords.vertexTopLeftY += top_left_y->get_double_value(timecode);
coords.vertexTopRightX += top_right_x->get_double_value(timecode);
coords.vertexTopRightY += top_right_y->get_double_value(timecode);
coords.vertexBottomLeftX += bottom_left_x->get_double_value(timecode);
coords.vertexBottomLeftY += bottom_left_y->get_double_value(timecode);
coords.vertexBottomRightX += bottom_right_x->get_double_value(timecode);
coords.vertexBottomRightY += bottom_right_y->get_double_value(timecode);
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef CORNERPINEFFECT_H
#define CORNERPINEFFECT_H
#include "../effect.h"
class CornerPinEffect : public Effect {
Q_OBJECT
public:
CornerPinEffect(Clip* c, const EffectMeta* em);
void process_coords(double timecode, GLTextureCoords& coords);
private:
EffectField* top_left_x;
EffectField* top_left_y;
EffectField* top_right_x;
EffectField* top_right_y;
EffectField* bottom_left_x;
EffectField* bottom_left_y;
EffectField* bottom_right_x;
EffectField* bottom_right_y;
};
#endif // CORNERPINEFFECT_H
+4 -2
View File
@@ -82,7 +82,8 @@ SOURCES += \
effects/internal/crossdissolvetransition.cpp \
effects/internal/shakeeffect.cpp \
effects/internal/exponentialfadetransition.cpp \
effects/internal/logarithmicfadetransition.cpp
effects/internal/logarithmicfadetransition.cpp \
effects/internal/cornerpineffect.cpp
HEADERS += \
mainwindow.h \
@@ -145,7 +146,8 @@ HEADERS += \
effects/internal/linearfadetransition.h \
effects/internal/crossdissolvetransition.h \
effects/internal/exponentialfadetransition.h \
effects/internal/logarithmicfadetransition.h
effects/internal/logarithmicfadetransition.h \
effects/internal/cornerpineffect.h
FORMS += \
mainwindow.ui \