Add lines

Adding waveform lines. Still requires scaling to
fit in arbitrary range.
This commit is contained in:
Troy James Sobotka
2020-04-28 15:06:22 -07:00
parent 5dd999b406
commit b9a62eb1aa
2 changed files with 31 additions and 8 deletions
+6 -6
View File
@@ -6,8 +6,7 @@
uniform sampler2D ove_maintex;
uniform vec2 ove_resolution;
uniform vec2 ove_viewport;
uniform float threshold;
uniform vec3 luma_coeffs;
in vec2 ove_texcoord;
@@ -33,6 +32,7 @@ void main(void) {
int y_lim = int(ove_resolution.y);
vec3 cur_col = vec3(0.0);
vec3 cur_lum = vec3(0.0);
for (int i = 0; i < y_lim; i++) {
cur_col = texture2D(
ove_maintex,
@@ -47,10 +47,10 @@ void main(void) {
// OCIO configuration or the RGB to XYZ matrix and multiplying
// the above step approach by the luminance weights.
// EG:
// cur_lum = cur_col * lum_coeffs;
//
// col += step(vec3(ove_texcoord.y - increment), cur_lum) *
// step(cur_lum, vec3(ove_texcoord.y + increment));
cur_lum = vec3(dot(cur_col, luma_coeffs));
col += step(vec3(ove_texcoord.y - increment), cur_lum) *
step(cur_lum, vec3(ove_texcoord.y + increment)) * intensity;
}
+25 -2
View File
@@ -21,6 +21,10 @@
#include "waveform.h"
#include <QPainter>
#include <QtMath>
#include <QDebug>
#include "node/node.h"
#include "render/backend/opengl/openglrenderfunctions.h"
@@ -95,6 +99,22 @@ void WaveformScope::paintGL()
color_service()->ProcessOpenGL();
QVector<QLine> ire_lines(6);
for (int i=1; i <= 5; i++) {
ire_lines[i].setLine(
0.0, height() * (i * 0.20), width(), height() *
(i * 0.20));
}
ire_lines[0].setLine(0.0, 0.0, width(), 0.0);
ire_lines[5].setLine(0.0, height() - 1.0, width(), height() - 1.0);
QPainter p(this);
p.setCompositionMode(QPainter::CompositionMode_Plus);
p.setPen(Qt::red);
p.drawLines(ire_lines);
texture_.Release();
framebuffer_.Release();
@@ -107,8 +127,11 @@ void WaveformScope::paintGL()
pipeline_->setUniformValue("ove_resolution", texture_.width(), texture_.height());
pipeline_->setUniformValue("ove_viewport", width(), height());
// The general size of a pixel
pipeline_->setUniformValue("threshold", 2.0f / static_cast<float>(height()));
GLfloat luma[3] = {0.0, 0.0, 0.0};
color_manager()->GetDefaultLumaCoefs(luma);
// qDebug() << "LUMA" << luma[0] << " " << luma[1] << " " << luma[2];
pipeline_->setUniformValue("luma_coeffs", luma[0], luma[1], luma[2]);
pipeline_->release();