GLES2: Fixes, clarifications to shaders

This commit is contained in:
20kdc
2020-08-29 19:55:16 +01:00
parent d1f0ea0112
commit 8acb0ba1a5
4 changed files with 6 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ const highp float PI = 3.14159265;
uniform highp float progress;
void fragment() {
highp vec4 col = texture2D(TEXTURE, UV);
highp vec4 col = zTexture(UV);
highp vec2 center = vec2(0.5,0.5);
highp vec2 delta = UV.xy - center;

View File

@@ -6,8 +6,8 @@ void fragment() {
highp float remaining = -pow(percentComplete, fadeFalloffExp) + 1.0;
// Two ghost textures that spin around the character
highp vec4 tex1 = texture2D(TEXTURE, vec2(UV.x + (0.02) * sin(TIME * 3.0), UV.y + (0.02) * cos(TIME * 3.0)));
highp vec4 tex2 = texture2D(TEXTURE, vec2(UV.x + (0.01) * sin(TIME * 2.0), UV.y + (0.01) * cos(TIME * 2.0)));
highp vec4 tex1 = zTexture(vec2(UV.x + (0.02) * sin(TIME * 3.0), UV.y + (0.02) * cos(TIME * 3.0)));
highp vec4 tex2 = zTexture(vec2(UV.x + (0.01) * sin(TIME * 2.0), UV.y + (0.01) * cos(TIME * 2.0)));
highp vec4 textureMix = mix(tex1, tex2, 0.5);

View File

@@ -35,12 +35,13 @@ uniform highp float outline_width; // = 2.0;
uniform highp vec4 outline_color; // =vec4(1.0,0.0,0.0,0.33);
void fragment() {
highp vec4 col = texture2D(TEXTURE, UV);
highp vec4 col = zTexture(UV);
highp vec2 ps = TEXTURE_PIXEL_SIZE;
highp float a;
highp float maxa = col.a;
highp float mina = col.a;
// note: these bypass zTexture because only alpha is queried.
a = texture2D(TEXTURE, UV + vec2(0.0, -outline_width)*ps).a;
maxa = max(a, maxa);
mina = min(a, mina);

View File

@@ -1,4 +1,5 @@
void fragment() {
// Bypasses zTexture because only alpha is queried.
if (texture2D(TEXTURE, UV).a == 0.0) {
discard; // Discard if no alpha so that there's a hole in the stencil buffer.
}