completed transition to gles 3.0

This commit is contained in:
itsmattkc
2019-03-18 02:34:11 +11:00
parent 69a02cb7c1
commit 17b5b0f2cf
6 changed files with 250 additions and 126 deletions
+15 -5
View File
@@ -838,7 +838,7 @@ void Effect::process_shader(double timecode, GLTextureCoords&, int iteration) {
{
DoubleField* double_field = static_cast<DoubleField*>(field);
shader_program_->setUniformValue(double_field->id().toUtf8().constData(),
GLfloat(double_field->GetDoubleAt(timecode)));
GLfloat(double_field->GetDoubleAt(timecode)));
}
break;
case EffectField::EFFECT_FIELD_COLOR:
@@ -988,12 +988,22 @@ void Effect::gizmo_world_to_screen(const QMatrix4x4& matrix, const QMatrix4x4& p
EffectGizmo* g = gizmos.at(i);
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) * (matrix * projection);
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);
QMatrix4x4 matrix2 = matrix;
// matrix2.flipCoordinates();
QMatrix4x4 projection2 = projection;
projection2.flipCoordinates();
QVector3D screen_pos = g->world_pos.at(j).project(matrix2,
projection2,
QRect(0,
0,
parent_clip->sequence->width,
parent_clip->sequence->height));
g->screen_pos[j] = QPoint(screen_pos.x(), screen_pos.y());
g->screen_pos[j] = QPoint(adjusted_sx1, adjusted_sy1);
}
}
}
+2 -2
View File
@@ -27,8 +27,8 @@ enum GizmoType {
GIZMO_TYPE_TARGET
};
#define GIZMO_DOT_SIZE 2.5
#define GIZMO_TARGET_SIZE 5.0
#define GIZMO_DOT_SIZE 2.5f
#define GIZMO_TARGET_SIZE 5.0f
#include <QObject>
#include <QString>
+17 -15
View File
@@ -218,28 +218,30 @@ void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, i
coords.opacity *= float(opacity->GetDoubleAt(timecode)*0.01);
}
QVector3D LerpVector3D(const QVector3D& a, const QVector3D& b, float t) {
return QVector3D(
float_lerp(a.x(), b.x(), t),
float_lerp(a.y(), b.y(), t),
float_lerp(a.z(), b.z(), t)
);
}
void TransformEffect::gizmo_draw(double, GLTextureCoords& coords) {
top_left_gizmo->world_pos[0] = coords.vertex_top_left;
top_right_gizmo->world_pos[0] = coords.vertex_top_right;
bottom_right_gizmo->world_pos[0] = coords.vertex_bottom_right;
bottom_left_gizmo->world_pos[0] = coords.vertex_bottom_left;
top_center_gizmo->world_pos[0] = QVector3D(lerp(coords.vertex_top_left.x(), coords.vertex_top_right.x(), 0.5),
lerp(coords.vertex_top_left.y(), coords.vertex_top_right.y(), 0.5),
0.0f);
right_center_gizmo->world_pos[0] = QVector3D(lerp(coords.vertex_top_right.x(), coords.vertex_bottom_right.x(), 0.5),
lerp(coords.vertex_top_right.y(), coords.vertex_bottom_right.y(), 0.5),
0.0f);
bottom_center_gizmo->world_pos[0] = QVector3D(lerp(coords.vertex_bottom_right.x(), coords.vertex_bottom_left.x(), 0.5),
lerp(coords.vertex_bottom_right.y(), coords.vertex_bottom_left.y(), 0.5),
0.0f);
left_center_gizmo->world_pos[0] = QVector3D(lerp(coords.vertex_bottom_left.x(), coords.vertex_top_left.x(), 0.5),
lerp(coords.vertex_bottom_left.y(), coords.vertex_top_left.y(), 0.5),
0.0f);
top_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_top_left, coords.vertex_top_right, 0.5);
right_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_top_right, coords.vertex_bottom_right, 0.5);
bottom_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_bottom_right, coords.vertex_bottom_left, 0.5);
left_center_gizmo->world_pos[0] = LerpVector3D(coords.vertex_bottom_left, coords.vertex_top_left, 0.5);
rotate_gizmo->world_pos[0] = QVector3D(lerp(top_center_gizmo->world_pos[0].x(), bottom_center_gizmo->world_pos[0].x(), -0.1),
lerp(top_center_gizmo->world_pos[0].y(), bottom_center_gizmo->world_pos[0].y(), -0.1),
0.0f);
rotate_gizmo->world_pos[0] = QVector3D(
float_lerp(top_center_gizmo->world_pos[0].x(), bottom_center_gizmo->world_pos[0].x(), 0.5f),
float_lerp(top_center_gizmo->world_pos[0].y(), bottom_center_gizmo->world_pos[0].y(), -0.1f),
0.0f
);
rect_gizmo->world_pos[0] = coords.vertex_top_left;
rect_gizmo->world_pos[1] = coords.vertex_top_right;