Corner pin (#1851)
* Start adding a corner pin node * Start gizmo support * Correctly setup QVector2d inputs * Missing breaks were causing incorect data to be set * Add ability to override vertex coords * Get perspective pin working * Cleanup * Add none perspective corner pin * Small optimisation * Improve comments, clean up and fix bug in job optimisation * [skip ci] cornerpin: Improve description * Move GL extension from shader to standard preamble. * Use #version 130 for mobile GPU compatibility * Cache half resolution * Use built in NodeInputDragger::GetStartValue * Pass cnst references to avoid deep copies Co-authored-by: itsmattkc <itsmattkc@gmail.com>
This commit is contained in:
co-authored by
itsmattkc
parent
41a49c4880
commit
f5b4729a19
@@ -22,6 +22,7 @@
|
||||
#define SHADERJOB_H
|
||||
|
||||
#include <QMatrix4x4>
|
||||
#include <QVector>
|
||||
|
||||
#include "generatejob.h"
|
||||
#include "render/texture.h"
|
||||
@@ -87,6 +88,16 @@ public:
|
||||
interpolation_.insert(id, interp);
|
||||
}
|
||||
|
||||
void SetVertexCoordinates(const QVector<float> &vertex_coords)
|
||||
{
|
||||
vertex_overrides_ = vertex_coords;
|
||||
}
|
||||
|
||||
const QVector<float>& GetVertexCoordinates()
|
||||
{
|
||||
return vertex_overrides_;
|
||||
}
|
||||
|
||||
private:
|
||||
QString shader_id_;
|
||||
|
||||
@@ -96,6 +107,8 @@ private:
|
||||
|
||||
QHash<QString, Texture::Interpolation> interpolation_;
|
||||
|
||||
QVector<float> vertex_overrides_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -569,7 +569,13 @@ void OpenGLRenderer::Blit(QVariant s, ShaderJob job, Texture *destination, Video
|
||||
QOpenGLBuffer vert_vbo_;
|
||||
vert_vbo_.create();
|
||||
vert_vbo_.bind();
|
||||
vert_vbo_.allocate(blit_vertices.constData(), blit_vertices.size() * sizeof(GLfloat));
|
||||
// If the job has vertex coordinate overrides use them instead of the defaults.
|
||||
if (!job.GetVertexCoordinates().isEmpty()) {
|
||||
Q_ASSERT(job.GetVertexCoordinates().size() == 18);
|
||||
vert_vbo_.allocate(job.GetVertexCoordinates().constData(), job.GetVertexCoordinates().size() * sizeof(float));
|
||||
} else {
|
||||
vert_vbo_.allocate(blit_vertices.constData(), blit_vertices.size() * sizeof(GLfloat));
|
||||
}
|
||||
vert_vbo_.release();
|
||||
|
||||
QOpenGLBuffer frag_vbo_;
|
||||
@@ -886,7 +892,11 @@ GLuint OpenGLRenderer::CompileShader(GLenum type, const QString &code)
|
||||
QStringLiteral("#version 120\n\n");
|
||||
#endif
|
||||
|
||||
QString complete_code = shader_preamble;
|
||||
QString complete_code;
|
||||
|
||||
if (!code.startsWith(QStringLiteral("#version"))) {
|
||||
complete_code = shader_preamble;
|
||||
}
|
||||
|
||||
if (code.isEmpty()) {
|
||||
// Use default code
|
||||
|
||||
Reference in New Issue
Block a user