Skip to content

Commit 1711511

Browse files
Kyborg2011kblaschke
authored andcommitted
Fixed variable using reserved word in vertex shader
OpenGL ES has a distance() function, and thus, the shader may fail to compile in some drivers, e.g. some Android releases.
1 parent 4e9040f commit 1711511

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Diff for: src/libprojectM/MilkdropPreset/Shaders/PresetWarpVertexShaderGlsl330.vert

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ precision mediump float;
1616
layout(location = 0) in vec2 vertex_position;
1717
layout(location = 1) in vec2 rad_ang;
1818
layout(location = 2) in vec4 transforms;
19-
layout(location = 3) in vec2 center;
20-
layout(location = 4) in vec2 distance;
19+
layout(location = 3) in vec2 warp_center;
20+
layout(location = 4) in vec2 warp_distance;
2121
layout(location = 5) in vec2 stretch;
2222

2323
uniform mat4 vertex_transformation;
@@ -47,8 +47,8 @@ void main() {
4747
pos.y * 0.5 + 0.5 + texelOffset.y);
4848

4949
// Stretch on X, Y
50-
u = (u - center.x) / stretch.x + center.x;
51-
v = (v - center.y) / stretch.y + center.y;
50+
u = (u - warp_center.x) / stretch.x + warp_center.x;
51+
v = (v - warp_center.y) / stretch.y + warp_center.y;
5252

5353
// Warping
5454
u += warp * 0.0035 * sin(warpTime * 0.333 + warpScaleInverse * (pos.x * warpFactors.x - pos.y * warpFactors.w));
@@ -57,17 +57,17 @@ void main() {
5757
v += warp * 0.0035 * sin(warpTime * 0.825 + warpScaleInverse * (pos.x * warpFactors.x + pos.y * warpFactors.w));
5858

5959
// Rotation
60-
float u2 = u - center.x;
61-
float v2 = v - center.y;
60+
float u2 = u - warp_center.x;
61+
float v2 = v - warp_center.y;
6262

6363
float cosRotation = cos(rot);
6464
float sinRotation = sin(rot);
65-
u = u2 * cosRotation - v2 * sinRotation + center.x;
66-
v = u2 * sinRotation + v2 * cosRotation + center.y;
65+
u = u2 * cosRotation - v2 * sinRotation + warp_center.x;
66+
v = u2 * sinRotation + v2 * cosRotation + warp_center.y;
6767

6868
// Translation
69-
u -= distance.x;
70-
v -= distance.y;
69+
u -= warp_distance.x;
70+
v -= warp_distance.y;
7171

7272
// Undo aspect ratio fix
7373
u = (u - 0.5) * invAspectX + 0.5;

0 commit comments

Comments
 (0)