Skip to content

Commit

Permalink
Merge pull request mixxxdj#13256 from m0dB/fix-slipmode-shader
Browse files Browse the repository at this point in the history
fix slipmode shader for macOS
  • Loading branch information
Swiftb0y authored May 22, 2024
2 parents 9893d75 + 331af20 commit d6ca42e
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/shaders/slipmodeshader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ 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;
varying highp vec4 vposition;
void main()
{
Expand All @@ -17,12 +16,11 @@ void main()
)--");

QString fragmentShaderCode = QStringLiteral(R"--(
#version 120
uniform highp vec4 color;
uniform highp vec2 borders;
uniform highp vec2 dimension;
in highp vec4 vposition;
varying highp vec4 vposition;
void main()
{
Expand All @@ -32,21 +30,21 @@ void main()
float upperBoard = borders.x;
float lowerBoard = borders.y;
if (yBorder < 0){
if (yBorder < 0.0){
float borderAlpha = max(
0,
0.0,
lowerBoard + yBorder
) / lowerBoard;
gl_FragColor = vec4(color.xyz, mix(0, color.w, borderAlpha));
gl_FragColor = vec4(color.xyz, mix(0.0, color.w, borderAlpha));
} else if( (xBorder > dimension.x - upperBoard && yBorder >= 0) || yBorder > dimension.y - upperBoard)
} else if( (xBorder > dimension.x - upperBoard && yBorder >= 0.0) || yBorder > dimension.y - upperBoard)
{
float borderAlpha = max(0, max(
float borderAlpha = max(0.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);
gl_FragColor = vec4(mix(vec3(0.0, 0.0, 0.0), color.rgb, min(color.w, borderAlpha)), 1.0);
} else {
gl_FragColor = vec4(0, 0, 0, 1);
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
}
}
)--");
Expand Down

0 comments on commit d6ca42e

Please sign in to comment.