gles transition almost complete
This commit is contained in:
+7
-15
@@ -735,12 +735,12 @@ void Effect::open() {
|
||||
} else {
|
||||
shader_program_ = std::make_shared<QOpenGLShaderProgram>();
|
||||
validate_meta_path();
|
||||
bool glsl_compiled = true;
|
||||
bool shader_compiled = true;
|
||||
if (!shader_vert_path_.isEmpty()) {
|
||||
if (shader_program_->addShaderFromSourceFile(QOpenGLShader::Vertex, meta->path + "/" + shader_vert_path_)) {
|
||||
qInfo() << "Vertex shader added successfully";
|
||||
} else {
|
||||
glsl_compiled = false;
|
||||
shader_compiled = false;
|
||||
qWarning() << "Vertex shader could not be added";
|
||||
}
|
||||
}
|
||||
@@ -748,11 +748,11 @@ void Effect::open() {
|
||||
if (shader_program_->addShaderFromSourceFile(QOpenGLShader::Fragment, meta->path + "/" + shader_frag_path_)) {
|
||||
qInfo() << "Fragment shader added successfully";
|
||||
} else {
|
||||
glsl_compiled = false;
|
||||
shader_compiled = false;
|
||||
qWarning() << "Fragment shader could not be added";
|
||||
}
|
||||
}
|
||||
if (glsl_compiled) {
|
||||
if (shader_compiled) {
|
||||
if (shader_program_->link()) {
|
||||
qInfo() << "Shader program linked successfully";
|
||||
} else {
|
||||
@@ -775,7 +775,7 @@ void Effect::close() {
|
||||
isOpen = false;
|
||||
}
|
||||
|
||||
bool Effect::is_glsl_linked() {
|
||||
bool Effect::is_shader_linked() {
|
||||
return shader_program_ != nullptr && shader_program_->isLinked();
|
||||
}
|
||||
|
||||
@@ -983,20 +983,12 @@ void Effect::gizmo_move(EffectGizmo* gizmo, int x_movement, int y_movement, doub
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
QMatrix4x4 projection_matrix(projection_val);
|
||||
|
||||
void Effect::gizmo_world_to_screen(const QMatrix4x4& matrix, const QMatrix4x4& projection) {
|
||||
for (int i=0;i<gizmos.size();i++) {
|
||||
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) * (view_matrix * projection_matrix);
|
||||
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);
|
||||
|
||||
+2
-2
@@ -172,7 +172,7 @@ public:
|
||||
bool is_open();
|
||||
void open();
|
||||
void close();
|
||||
bool is_glsl_linked();
|
||||
bool is_shader_linked();
|
||||
virtual void startEffect();
|
||||
virtual void endEffect();
|
||||
|
||||
@@ -198,7 +198,7 @@ public:
|
||||
|
||||
virtual void gizmo_draw(double timecode, GLTextureCoords& coords);
|
||||
void gizmo_move(EffectGizmo* sender, int x_movement, int y_movement, double timecode, bool done);
|
||||
void gizmo_world_to_screen();
|
||||
void gizmo_world_to_screen(const QMatrix4x4 &matrix, const QMatrix4x4 &projection);
|
||||
bool are_gizmos_enabled();
|
||||
|
||||
template <typename T>
|
||||
|
||||
@@ -4,8 +4,10 @@ precision mediump float;
|
||||
#endif
|
||||
|
||||
uniform sampler2D texture;
|
||||
uniform float opacity;
|
||||
varying vec2 v_texcoord;
|
||||
|
||||
void main() {
|
||||
gl_FragColor = texture2D(texture, v_texcoord);
|
||||
vec4 color = texture2D(texture, v_texcoord)*opacity;
|
||||
gl_FragColor = color;
|
||||
}
|
||||
@@ -78,10 +78,7 @@ void ShakeEffect::process_coords(double timecode, GLTextureCoords& coords, int)
|
||||
yoff *= multiplier;
|
||||
rotoff *= rotmult;
|
||||
|
||||
coords.vertex_top_left += QVector3D(xoff, yoff, 0.0);
|
||||
coords.vertex_top_right += QVector3D(xoff, yoff, 0.0);
|
||||
coords.vertex_bottom_left += QVector3D(xoff, yoff, 0.0);
|
||||
coords.vertex_bottom_right += QVector3D(xoff, yoff, 0.0);
|
||||
coords.matrix.translate(xoff, yoff, 0.0);
|
||||
|
||||
glRotatef(rotoff, 0, 0, 1);
|
||||
coords.matrix.rotate(QQuaternion::fromEulerAngles(0.0f, 0.0f, rotoff));
|
||||
}
|
||||
|
||||
@@ -190,9 +190,9 @@ void TransformEffect::toggle_uniform_scale(bool enabled) {
|
||||
|
||||
void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, int) {
|
||||
// position
|
||||
glTranslated(position_x->GetDoubleAt(timecode)-(parent_clip->sequence->width/2),
|
||||
position_y->GetDoubleAt(timecode)-(parent_clip->sequence->height/2),
|
||||
0);
|
||||
coords.matrix.translate(position_x->GetDoubleAt(timecode)-(parent_clip->sequence->width/2),
|
||||
position_y->GetDoubleAt(timecode)-(parent_clip->sequence->height/2),
|
||||
0);
|
||||
|
||||
// anchor point
|
||||
int anchor_x_offset = qRound(anchor_x_box->GetDoubleAt(timecode));
|
||||
@@ -204,12 +204,12 @@ void TransformEffect::process_coords(double timecode, GLTextureCoords& coords, i
|
||||
coords.vertex_bottom_right -= QVector3D(anchor_x_offset, anchor_y_offset, 0.0f);
|
||||
|
||||
// rotation
|
||||
glRotated(rotation->GetDoubleAt(timecode), 0, 0, 1);
|
||||
coords.matrix.rotate(QQuaternion::fromEulerAngles(0, 0, rotation->GetDoubleAt(timecode)));
|
||||
|
||||
// scale
|
||||
double sx = scale_x->GetDoubleAt(timecode)*0.01;
|
||||
double sy = (uniform_scale_field->GetBoolAt(timecode)) ? sx : scale_y->GetDoubleAt(timecode)*0.01;
|
||||
glScaled(sx, sy, 1);
|
||||
coords.matrix.scale(sx, sy);
|
||||
|
||||
// blend mode
|
||||
coords.blendmode = blend_mode_box->GetValueAt(timecode).toInt();
|
||||
|
||||
Reference in New Issue
Block a user