fixed critical bug that corrupts transitions
This commit is contained in:
+39
-5
@@ -223,7 +223,6 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
enable_shader(false),
|
||||
enable_coords(false),
|
||||
enable_superimpose(false),
|
||||
enable_gizmos(false),
|
||||
glslProgram(NULL),
|
||||
texture(NULL),
|
||||
isOpen(false),
|
||||
@@ -456,7 +455,21 @@ EffectRow* Effect::row(int i) {
|
||||
}
|
||||
|
||||
int Effect::row_count() {
|
||||
return rows.size();
|
||||
return rows.size();
|
||||
}
|
||||
|
||||
EffectGizmo *Effect::add_gizmo(int type) {
|
||||
EffectGizmo* gizmo = new EffectGizmo(type);
|
||||
gizmos.append(gizmo);
|
||||
return gizmo;
|
||||
}
|
||||
|
||||
EffectGizmo *Effect::gizmo(int i) {
|
||||
return gizmos.at(i);
|
||||
}
|
||||
|
||||
int Effect::gizmo_count(){
|
||||
return gizmos.size();
|
||||
}
|
||||
|
||||
void Effect::refresh() {}
|
||||
@@ -834,9 +847,30 @@ void Effect::process_audio(double, double, quint8*, int, int) {
|
||||
}
|
||||
|
||||
void Effect::gizmo_draw(double, GLTextureCoords &) {}
|
||||
void Effect::gizmo_down(QMouseEvent *, double) {}
|
||||
void Effect::gizmo_move(QMouseEvent *, double) {}
|
||||
void Effect::gizmo_up(QMouseEvent *, double) {}
|
||||
void Effect::gizmo_move(EffectGizmo* , int , int , double ) {}
|
||||
|
||||
void Effect::gizmo_world_to_screen() {
|
||||
GLfloat view_val[16];
|
||||
GLfloat projection_val[16];
|
||||
glGetFloatv(GL_MODELVIEW_MATRIX, view_val);
|
||||
glGetFloatv(GL_PROJECTION_MATRIX, projection_val);
|
||||
|
||||
QMatrix4x4 view_matrix(view_val[0], view_val[4], view_val[8], view_val[12], view_val[1], view_val[5], view_val[9], view_val[13], view_val[2], view_val[6], view_val[10], view_val[14], view_val[3], view_val[7], view_val[11], view_val[15]);
|
||||
QMatrix4x4 projection_matrix(projection_val[0], projection_val[4], projection_val[8], projection_val[12], projection_val[1], projection_val[5], projection_val[9], projection_val[13], projection_val[2], projection_val[6], projection_val[10], projection_val[14], projection_val[3], projection_val[7], projection_val[11], projection_val[15]);
|
||||
|
||||
for (int i=0;i<gizmos.size();i++) {
|
||||
EffectGizmo* g = gizmos.at(i);
|
||||
|
||||
QVector4D world_pos(g->get_x(), g->get_y(), 0, 1.0);
|
||||
QVector4D screen_pos = world_pos * (view_matrix * projection_matrix);
|
||||
|
||||
g->set_screen_pos(screen_pos.x(), screen_pos.y());
|
||||
}
|
||||
}
|
||||
|
||||
bool Effect::are_gizmos_enabled() {
|
||||
return (gizmos.size() > 0);
|
||||
}
|
||||
|
||||
void Effect::redraw(double) {
|
||||
/*
|
||||
|
||||
+11
-6
@@ -1,4 +1,4 @@
|
||||
#ifndef EFFECT_H
|
||||
#ifndef EFFECT_H
|
||||
#define EFFECT_H
|
||||
|
||||
#include <QObject>
|
||||
@@ -105,6 +105,7 @@ qint16 mix_audio_sample(qint16 a, qint16 b);
|
||||
|
||||
#include "effectfield.h"
|
||||
#include "effectrow.h"
|
||||
#include "effectgizmo.h"
|
||||
|
||||
class Effect : public QObject {
|
||||
Q_OBJECT
|
||||
@@ -121,6 +122,10 @@ public:
|
||||
EffectRow* row(int i);
|
||||
int row_count();
|
||||
|
||||
EffectGizmo* add_gizmo(int type);
|
||||
EffectGizmo* gizmo(int i);
|
||||
int gizmo_count();
|
||||
|
||||
bool is_enabled();
|
||||
void set_enabled(bool b);
|
||||
|
||||
@@ -140,8 +145,7 @@ public:
|
||||
|
||||
bool enable_shader;
|
||||
bool enable_coords;
|
||||
bool enable_superimpose;
|
||||
bool enable_gizmos;
|
||||
bool enable_superimpose;
|
||||
|
||||
int getIterations();
|
||||
void setIterations(int i);
|
||||
@@ -154,9 +158,9 @@ public:
|
||||
virtual void process_audio(double timecode_start, double timecode_end, quint8* samples, int nb_bytes, int channel_count);
|
||||
|
||||
virtual void gizmo_draw(double timecode, GLTextureCoords& coords);
|
||||
virtual void gizmo_down(QMouseEvent* event, double);
|
||||
virtual void gizmo_move(QMouseEvent* event, double);
|
||||
virtual void gizmo_up(QMouseEvent* event, double);
|
||||
virtual void gizmo_move(EffectGizmo* sender, int x_movement, int y_movement, double timecode);
|
||||
void gizmo_world_to_screen();
|
||||
bool are_gizmos_enabled();
|
||||
public slots:
|
||||
void field_changed();
|
||||
private slots:
|
||||
@@ -179,6 +183,7 @@ private:
|
||||
|
||||
bool isOpen;
|
||||
QVector<EffectRow*> rows;
|
||||
QVector<EffectGizmo*> gizmos;
|
||||
QGridLayout* ui_layout;
|
||||
QWidget* ui;
|
||||
bool bound;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "effectgizmo.h"
|
||||
|
||||
EffectGizmo::EffectGizmo(int type) :
|
||||
type(type)
|
||||
{}
|
||||
|
||||
void EffectGizmo::set_pos(int ix, int iy) {
|
||||
x = ix;
|
||||
y = iy;
|
||||
}
|
||||
|
||||
int EffectGizmo::get_x() {
|
||||
return x;
|
||||
}
|
||||
|
||||
int EffectGizmo::get_y() {
|
||||
return y;
|
||||
}
|
||||
|
||||
int EffectGizmo::get_type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
void EffectGizmo::set_screen_pos(int isx, int isy) {
|
||||
sx = isx;
|
||||
sy = isy;
|
||||
}
|
||||
|
||||
int EffectGizmo::get_screen_x() {
|
||||
return sx;
|
||||
}
|
||||
|
||||
int EffectGizmo::get_screen_y() {
|
||||
return sy;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef EFFECTGIZMO_H
|
||||
#define EFFECTGIZMO_H
|
||||
|
||||
#define GIZMO_TYPE_DOT 0
|
||||
#define GIZMO_TYPE_QUAD 1
|
||||
|
||||
#include <QString>
|
||||
|
||||
class EffectGizmo
|
||||
{
|
||||
public:
|
||||
EffectGizmo(int type);
|
||||
|
||||
void set_pos(int ix, int iy);
|
||||
int get_x();
|
||||
int get_y();
|
||||
int get_type();
|
||||
|
||||
void set_screen_pos(int isx, int isy);
|
||||
int get_screen_x();
|
||||
int get_screen_y();
|
||||
private:
|
||||
int type;
|
||||
int x;
|
||||
int y;
|
||||
int sx;
|
||||
int sy;
|
||||
};
|
||||
|
||||
#endif // EFFECTGIZMO_H
|
||||
Reference in New Issue
Block a user