gizmos fairly complete
This commit is contained in:
+6
-5
@@ -861,13 +861,14 @@ void Effect::gizmo_world_to_screen() {
|
||||
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);
|
||||
for (int j=0;j<g->get_point_count();j++) {
|
||||
QVector4D screen_pos = QVector4D(g->world_pos[j].x(), g->world_pos[j].y(), 0, 1.0) * (view_matrix * projection_matrix);
|
||||
|
||||
int adjusted_sx = qRound(((screen_pos.x()*0.5)+0.5)*parent_clip->sequence->width);
|
||||
int adjusted_sy = qRound((1.0-((screen_pos.y()*0.5)+0.5))*parent_clip->sequence->height);
|
||||
int adjusted_sx1 = qRound(((screen_pos.x()*0.5f)+0.5f)*parent_clip->sequence->width);
|
||||
int adjusted_sy1 = qRound((1.0f-((screen_pos.y()*0.5f)+0.5f))*parent_clip->sequence->height);
|
||||
|
||||
g->set_screen_pos(adjusted_sx, adjusted_sy);
|
||||
g->screen_pos[j] = QPoint(adjusted_sx1, adjusted_sy1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-23
@@ -3,38 +3,22 @@
|
||||
EffectGizmo::EffectGizmo(int type) :
|
||||
type(type),
|
||||
cursor(-1)
|
||||
{}
|
||||
{
|
||||
int point_count = (type == GIZMO_TYPE_POLY) ? 4 : 1;
|
||||
world_pos.resize(point_count);
|
||||
screen_pos.resize(point_count);
|
||||
|
||||
void EffectGizmo::set_pos(int ix, int iy) {
|
||||
x = ix;
|
||||
y = iy;
|
||||
color = Qt::white;
|
||||
}
|
||||
|
||||
int EffectGizmo::get_x() {
|
||||
return x;
|
||||
}
|
||||
|
||||
int EffectGizmo::get_y() {
|
||||
return y;
|
||||
int EffectGizmo::get_point_count() {
|
||||
return world_pos.size();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
int EffectGizmo::get_cursor() {
|
||||
return cursor;
|
||||
}
|
||||
|
||||
+9
-12
@@ -2,35 +2,32 @@
|
||||
#define EFFECTGIZMO_H
|
||||
|
||||
#define GIZMO_TYPE_DOT 0
|
||||
#define GIZMO_TYPE_QUAD 1
|
||||
#define GIZMO_TYPE_POLY 1
|
||||
|
||||
#define GIZMO_DOT_SIZE 2.5F
|
||||
|
||||
#include <QString>
|
||||
#include <QRect>
|
||||
#include <QPoint>
|
||||
#include <QVector>
|
||||
#include <QColor>
|
||||
|
||||
class EffectGizmo
|
||||
{
|
||||
public:
|
||||
EffectGizmo(int type);
|
||||
|
||||
void set_pos(int ix, int iy);
|
||||
int get_x();
|
||||
int get_y();
|
||||
int get_type();
|
||||
QVector<QPoint> world_pos;
|
||||
QVector<QPoint> screen_pos;
|
||||
QColor color;
|
||||
int get_point_count();
|
||||
|
||||
void set_screen_pos(int isx, int isy);
|
||||
int get_screen_x();
|
||||
int get_screen_y();
|
||||
int get_type();
|
||||
|
||||
int get_cursor();
|
||||
void set_cursor(int c);
|
||||
private:
|
||||
int type;
|
||||
int x;
|
||||
int y;
|
||||
int sx;
|
||||
int sy;
|
||||
int cursor;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user