Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

use step() rather than if() for the depth calculation

  • Loading branch information...
commit 9b92fafcfe1a40c3ee964031743784e9874c32b3 1 parent 1c215fe
Jonathan Marshall authored
View
5 system/shaders/ftb2/glshader_frag_fonts.glsl
@@ -30,8 +30,5 @@ void main ()
float a = m_colour.a * texture2D(m_samp0, m_cord0.xy).a;
gl_FragColor.rgb = m_colour.rgb * a;
gl_FragColor.a = a;
- if (a < 0.996)
- gl_FragDepth = 0.0;
- else
- gl_FragDepth = m_depth;
+ gl_FragDepth = step(0.996, a)*m_depth;
}
View
5 system/shaders/ftb2/glshader_frag_multi.glsl
@@ -32,8 +32,5 @@ void main ()
vec4 col = (texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy)).bgra;
gl_FragColor.rgb = col.rgb * col.a;
gl_FragColor.a = col.a;
- if (col.a < 0.996)
- gl_FragDepth = 0.0;
- else
- gl_FragDepth = m_depth;
+ gl_FragDepth = step(0.996, col.a)*m_depth;
}
View
5 system/shaders/ftb2/glshader_frag_multi_blendcolor.glsl
@@ -32,8 +32,5 @@ void main ()
vec4 col = (texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy)).bgra * m_colour;
gl_FragColor.rgb = col.rgb * col.a;
gl_FragColor.a = col.a;
- if (col.a < 0.996)
- gl_FragDepth = 0.0;
- else
- gl_FragDepth = m_depth;
+ gl_FragDepth = step(0.996, col.a)*m_depth;
}
View
5 system/shaders/ftb2/glshader_frag_texture.glsl
@@ -30,8 +30,5 @@ void main ()
vec4 col = vec4(texture2D(m_samp0, m_cord0.xy).bgra * m_colour);
gl_FragColor.rgb = col.rgb * col.a;
gl_FragColor.a = col.a;
- if (col.a < 0.996)
- gl_FragDepth = 0.0;
- else
- gl_FragDepth = m_depth;
+ gl_FragDepth = step(0.996, col.a)*m_depth;
}
View
5 system/shaders/ftb2/guishader_frag_fonts.glsl
@@ -31,8 +31,5 @@ void main ()
lowp float a = m_colour.a * texture2D(m_samp0, m_cord0.xy).a;
gl_FragColor.rgb = m_colour.rgb * a;
gl_FragColor.b = a;
- if (a < 0.996)
- gl_FragDepth = 0.0;
- else
- gl_FragDepth = m_depth;
+ gl_FragDepth = step(0.996, a)*m_depth;
}
View
5 system/shaders/ftb2/guishader_frag_multi.glsl
@@ -32,8 +32,5 @@ void main ()
lowp vec4 col = (texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy)).bgra;
gl_FragColor.rgb = col.rgb * col.a;
gl_FragColor.a = col.a;
- if (a < 0.996)
- gl_FragDepth = 0.0;
- else
- gl_FragDepth = m_depth;
+ gl_FragDepth = step(0.996, col.a)*m_depth;
}
View
5 system/shaders/ftb2/guishader_frag_multi_blendcolor.glsl
@@ -33,8 +33,5 @@ void main ()
lowp vec4 col = (texture2D(m_samp0, m_cord0.xy) * texture2D(m_samp1, m_cord1.xy)).bgra * m_colour;
gl_FragColor.rgb = col.rgb * col.a;
gl_FragColor.a = col.a;
- if (a < 0.996)
- gl_FragDepth = 0.0;
- else
- gl_FragDepth = m_depth;
+ gl_FragDepth = step(0.996, col.a)*m_depth;
}
View
5 system/shaders/ftb2/guishader_frag_texture.glsl
@@ -31,8 +31,5 @@ void main ()
lowp vec4 col = vec4(texture2D(m_samp0, m_cord0.xy).bgra * m_colour);
gl_FragColor.rgb = col.rgb * col.a;
gl_FragColor.a = col.a;
- if (a < 0.996)
- gl_FragDepth = 0.0;
- else
- gl_FragDepth = m_depth;
+ gl_FragDepth = step(0.996, col.a)*m_depth;
}

0 comments on commit 9b92faf

Please sign in to comment.
Something went wrong with that request. Please try again.