Add lines
Adding waveform lines. Still requires scaling to fit in arbitrary range.
This commit is contained in:
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user