Skip to content

Commit

Permalink
fixes post rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
m0dB authored and m0dB committed Apr 19, 2024
1 parent 643901c commit d8628c1
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 100 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1503,7 +1503,6 @@ if(QOPENGL)
src/shaders/endoftrackshader.cpp
src/shaders/patternshader.cpp
src/shaders/rgbashader.cpp
src/shaders/coloredtextureshader.cpp
src/shaders/rgbshader.cpp
src/shaders/shader.cpp
src/shaders/textureshader.cpp
Expand Down
35 changes: 0 additions & 35 deletions src/shaders/coloredtextureshader.cpp

This file was deleted.

39 changes: 0 additions & 39 deletions src/shaders/coloredtextureshader.h

This file was deleted.

12 changes: 4 additions & 8 deletions src/waveform/renderers/allshader/digitsrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <QPainter>
#include <QPainterPath>

#include "util/texture.h"
#include "waveform/renderers/allshader/matrixforwidgetgeometry.h"
#include "waveform/renderers/allshader/vertexdata.h"

Expand All @@ -35,7 +34,7 @@ void allshader::DigitsRenderer::init() {
}

float allshader::DigitsRenderer::height() const {
return static_cast<float>(m_pTexture->height());
return static_cast<float>(m_texture.height());
}

void allshader::DigitsRenderer::generateTexture(int fontPixelSize, float devicePixelRatio) {
Expand Down Expand Up @@ -116,14 +115,13 @@ void allshader::DigitsRenderer::generateTexture(int fontPixelSize, float deviceP

painter.end();

m_pTexture = createTexture(image);
m_texture.setData(image);
}

float allshader::DigitsRenderer::draw(const QMatrix4x4& matrix,
float x,
float y,
const QString& s,
QColor color,
float devicePixelRatio) {
const int n = s.length();
const float x0 = x;
Expand Down Expand Up @@ -151,10 +149,8 @@ float allshader::DigitsRenderer::draw(const QMatrix4x4& matrix,
const int textureLocation = m_shader.uniformLocation("texture");
const int positionLocation = m_shader.attributeLocation("position");
const int texcoordLocation = m_shader.attributeLocation("texcoord");
const int colorLocation = m_shader.colorLocation();

m_shader.setUniformValue(matrixLocation, matrix);
m_shader.setUniformValue(colorLocation, color);

m_shader.enableAttributeArray(positionLocation);
m_shader.setAttributeArray(
Expand All @@ -165,11 +161,11 @@ float allshader::DigitsRenderer::draw(const QMatrix4x4& matrix,

m_shader.setUniformValue(textureLocation, 0);

m_pTexture->bind();
m_texture.bind();

glDrawArrays(GL_TRIANGLES, 0, posVertices.size());

m_pTexture->release();
m_texture.release();

m_shader.disableAttributeArray(positionLocation);
m_shader.disableAttributeArray(texcoordLocation);
Expand Down
10 changes: 4 additions & 6 deletions src/waveform/renderers/allshader/digitsrenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

#include <QOpenGLFunctions>

#include "shaders/coloredtextureshader.h"

class QOpenGLTexture;
#include "shaders/textureshader.h"
#include "util/opengltexture2d.h"

namespace allshader {
class DigitsRenderer;
Expand All @@ -21,13 +20,12 @@ class allshader::DigitsRenderer : public QOpenGLFunctions {
float x,
float y,
const QString& s,
QColor color,
float devicePixelRatio);
float height() const;

private:
mixxx::ColoredTextureShader m_shader;
std::unique_ptr<QOpenGLTexture> m_pTexture;
mixxx::TextureShader m_shader;
OpenGLTexture2D m_texture;
float m_offset[13];
float m_width[12];

Expand Down
10 changes: 2 additions & 8 deletions src/waveform/renderers/allshader/waveformrendermark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ void allshader::WaveformRenderMark::paintGL() {
const float markHalfWidth = m_playPosMarkTexture.width() / devicePixelRatio / 2.f;
const float drawOffset = currentMarkPoint - markHalfWidth;

drawTexture(matrix, drawOffset, 0.f, m_pPlayPosMarkTexture.get());
drawTexture(matrix, drawOffset, 0.f, &m_playPosMarkTexture);
}

if (WaveformWidgetFactory::instance()->getUntilNextMarkerShow() != UntilNextMarkerShow::None) {
updateUntilMark(playPosition, nextMarkPosition);
drawUntilMark(matrix, drawOffset + 20);
drawUntilMark(matrix, currentMarkPoint + 20);
}
}

Expand All @@ -299,8 +299,6 @@ void allshader::WaveformRenderMark::drawUntilMark(const QMatrix4x4& matrix, floa
if (m_timeUntilMark == 0.0) {
return;
}
const int ialpha = 255;

const float ch = m_digitsRenderer.height() / devicePixelRatio;

float y = untilNextMarkerAlign == Qt::AlignTop ? 0.f
Expand All @@ -326,7 +324,6 @@ void allshader::WaveformRenderMark::drawUntilMark(const QMatrix4x4& matrix, floa
x,
y,
QString::number(m_beatsUntilMark),
QColor(255, 255, 255, ialpha),
devicePixelRatio);
if (untilNextMarkerShow == UntilNextMarkerShow::BeatsAndTime) {
x += w + std::round(static_cast<float>(m_untilNextMarkerSize) * 0.75f);
Expand All @@ -343,10 +340,7 @@ void allshader::WaveformRenderMark::drawUntilMark(const QMatrix4x4& matrix, floa
x,
y,
timeToString(m_timeUntilMark),
>>>>>>> 13349d0e47 (also show time until marker)
QColor(255, 255, 255, ialpha),
devicePixelRatio);
>>>>>>> ea0a4d064d (show beats until next marker, using digitsrenderer with digits texture (generated) and fade out during beat duration)
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/waveform/renderers/allshader/waveformrendermark.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ class allshader::WaveformRenderMark : public ::WaveformRenderMarkBase,

void drawMark(const QMatrix4x4& matrix, const QRectF& rect, QColor color);
void drawTexture(const QMatrix4x4& matrix, float x, float y, QOpenGLTexture* texture);

void updateBeatDistance(double playPosition, double markerPosition);
void updateUntilMark(double playPosition, double markerPosition);
void drawUntilMark(const QMatrix4x4& matrix, float x);

mixxx::RGBAShader m_rgbaShader;
mixxx::TextureShader m_textureShader;
OpenGLTexture2D m_playPosMarkTexture;
DigitsRenderer m_digitsRenderer;
int m_beatDistance;
int m_beatsUntilMark;
double m_timeUntilMark;
double m_currentBeatPosition;
double m_nextBeatPosition;
int m_untilNextMarkerSize;
Expand Down

0 comments on commit d8628c1

Please sign in to comment.