-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13002 from acolombier/feat/slipmode-render
SlipMode waveform visual for RGB GLSL
- Loading branch information
Showing
23 changed files
with
449 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include "shaders/slipmodeshader.h" | ||
|
||
using namespace mixxx; | ||
|
||
void SlipModeShader::init() { | ||
QString vertexShaderCode = QStringLiteral(R"--( | ||
#version 150 | ||
attribute highp vec4 position; // use vec4 here (will be padded) to assign directly to gl_Position | ||
out highp vec4 vposition; | ||
void main() | ||
{ | ||
vposition = position; | ||
gl_Position = position; | ||
} | ||
)--"); | ||
|
||
QString fragmentShaderCode = QStringLiteral(R"--( | ||
#version 120 | ||
uniform highp vec4 color; | ||
uniform highp vec2 borders; | ||
uniform highp vec2 dimension; | ||
in highp vec4 vposition; | ||
void main() | ||
{ | ||
float xBorder = abs(dimension.x * vposition.x); | ||
float yBorder = dimension.y * vposition.y; | ||
float upperBoard = borders.x; | ||
float lowerBoard = borders.y; | ||
if (yBorder < 0){ | ||
float borderAlpha = max( | ||
0, | ||
lowerBoard + yBorder | ||
) / lowerBoard; | ||
gl_FragColor = vec4(color.xyz, mix(0, color.w, borderAlpha)); | ||
} else if( (xBorder > dimension.x - upperBoard && yBorder >= 0) || yBorder > dimension.y - upperBoard) | ||
{ | ||
float borderAlpha = max(0, max( | ||
yBorder - dimension.y, | ||
xBorder - dimension.x) + upperBoard) / upperBoard; | ||
gl_FragColor = vec4(mix(vec3(0, 0, 0), color.rgb, min(color.w, borderAlpha)), 1); | ||
} else { | ||
gl_FragColor = vec4(0, 0, 0, 1); | ||
} | ||
} | ||
)--"); | ||
|
||
load(vertexShaderCode, fragmentShaderCode); | ||
|
||
m_positionLocation = attributeLocation("position"); | ||
m_boarderLocation = uniformLocation("borders"); | ||
m_dimensionLocation = uniformLocation("dimension"); | ||
m_colorLocation = uniformLocation("color"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#pragma once | ||
|
||
#include "shaders/shader.h" | ||
|
||
namespace mixxx { | ||
class SlipModeShader; | ||
} | ||
|
||
class mixxx::SlipModeShader : public mixxx::Shader { | ||
public: | ||
SlipModeShader() = default; | ||
~SlipModeShader() = default; | ||
void init(); | ||
|
||
int positionLocation() const { | ||
return m_positionLocation; | ||
} | ||
int dimensionLocation() const { | ||
return m_dimensionLocation; | ||
} | ||
int colorLocation() const { | ||
return m_colorLocation; | ||
} | ||
int boarderLocation() const { | ||
return m_boarderLocation; | ||
} | ||
|
||
private: | ||
int m_positionLocation; | ||
int m_dimensionLocation; | ||
int m_colorLocation; | ||
int m_boarderLocation; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(SlipModeShader) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.