@@ -35,7 +35,8 @@ uniform vec2 u_skinSize;
35
35
uniform float u_mosaic;
36
36
#endif // ENABLE_mosaic
37
37
38
- varying vec2 v_texCoord;
38
+ in vec2 v_texCoord;
39
+ out vec4 fragColor;
39
40
uniform sampler2D u_skin;
40
41
41
42
// Add this to divisors to prevent division by 0, which results in NaNs propagating through calculations.
@@ -147,16 +148,16 @@ void main()
147
148
}
148
149
#endif // ENABLE_fisheye
149
150
150
- gl_FragColor = texture2D (u_skin, texcoord0);
151
+ fragColor = texture (u_skin, texcoord0);
151
152
152
153
#if defined(ENABLE_color) || defined(ENABLE_brightness)
153
154
// Divide premultiplied alpha values for proper color processing
154
155
// Add epsilon to avoid dividing by 0 for fully transparent pixels
155
- gl_FragColor .rgb = clamp (gl_FragColor .rgb / (gl_FragColor .a + epsilon), 0.0 , 1.0 );
156
+ fragColor .rgb = clamp (fragColor .rgb / (fragColor .a + epsilon), 0.0 , 1.0 );
156
157
157
158
#ifdef ENABLE_color
158
159
{
159
- vec3 hsv = convertRGB2HSV(gl_FragColor .rgb);
160
+ vec3 hsv = convertRGB2HSV(fragColor .rgb);
160
161
161
162
// Force grayscale values to be slightly saturated
162
163
const float minLightness = 0.11 / 2.0 ;
@@ -167,20 +168,20 @@ void main()
167
168
hsv.x = mod (hsv.x + u_color, 1.0 );
168
169
if (hsv.x < 0.0 ) hsv.x += 1.0 ;
169
170
170
- gl_FragColor .rgb = convertHSV2RGB(hsv);
171
+ fragColor .rgb = convertHSV2RGB(hsv);
171
172
}
172
173
#endif // ENABLE_color
173
174
174
175
#ifdef ENABLE_brightness
175
- gl_FragColor .rgb = clamp (gl_FragColor .rgb + vec3 (u_brightness), vec3 (0 ), vec3 (1 ));
176
+ fragColor .rgb = clamp (fragColor .rgb + vec3 (u_brightness), vec3 (0 ), vec3 (1 ));
176
177
#endif // ENABLE_brightness
177
178
178
179
// Re-multiply color values
179
- gl_FragColor .rgb *= gl_FragColor .a + epsilon;
180
+ fragColor .rgb *= fragColor .a + epsilon;
180
181
181
182
#endif // defined(ENABLE_color) || defined(ENABLE_brightness)
182
183
183
184
#ifdef ENABLE_ghost
184
- gl_FragColor *= u_ghost;
185
+ fragColor *= u_ghost;
185
186
#endif // ENABLE_ghost
186
187
}
0 commit comments