2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_variables_start ***/
|
2008-06-24 16:21:40 +00:00
|
|
|
|
2008-06-06 14:21:22 +00:00
|
|
|
/* There is no default precision for floats in fragment shaders in
|
|
|
|
GLES 2 so we need to define one */
|
2008-12-11 15:33:38 +00:00
|
|
|
precision highp float;
|
|
|
|
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_inputs ***/
|
2008-06-06 14:21:22 +00:00
|
|
|
|
2008-05-27 17:42:50 +00:00
|
|
|
/* Inputs from the vertex shader */
|
2010-07-23 16:46:41 +00:00
|
|
|
varying vec4 _cogl_color;
|
|
|
|
varying float _cogl_fog_amount;
|
2008-05-27 17:42:50 +00:00
|
|
|
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_texturing_options ***/
|
2008-12-11 15:33:38 +00:00
|
|
|
|
2008-05-27 17:42:50 +00:00
|
|
|
/* Texturing options */
|
2008-12-11 15:33:38 +00:00
|
|
|
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_fogging_options ***/
|
2008-05-27 17:42:50 +00:00
|
|
|
|
2008-05-28 17:14:17 +00:00
|
|
|
/* Fogging options */
|
2010-07-23 16:46:41 +00:00
|
|
|
uniform vec4 _cogl_fog_color;
|
2008-05-28 17:14:17 +00:00
|
|
|
|
2008-05-29 13:29:04 +00:00
|
|
|
/* Alpha test options */
|
2010-07-23 16:46:41 +00:00
|
|
|
uniform float _cogl_alpha_test_ref;
|
2008-05-29 13:29:04 +00:00
|
|
|
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_main_declare ***/
|
2008-12-11 15:33:38 +00:00
|
|
|
|
2008-05-27 17:42:50 +00:00
|
|
|
void
|
|
|
|
main (void)
|
|
|
|
{
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_main_start ***/
|
2008-05-28 17:14:17 +00:00
|
|
|
|
2008-06-24 16:21:40 +00:00
|
|
|
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_fog ***/
|
2008-06-24 16:21:40 +00:00
|
|
|
|
|
|
|
/* Mix the calculated color with the fog color */
|
2010-07-23 16:46:41 +00:00
|
|
|
gl_FragColor.rgb = mix (_cogl_fog_color.rgb, gl_FragColor.rgb,
|
|
|
|
_cogl_fog_amount);
|
2008-05-29 13:29:04 +00:00
|
|
|
|
|
|
|
/* Alpha testing */
|
2008-06-24 16:21:40 +00:00
|
|
|
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_alpha_never ***/
|
2008-06-24 16:21:40 +00:00
|
|
|
discard;
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_alpha_less ***/
|
2010-07-23 16:46:41 +00:00
|
|
|
if (gl_FragColor.a >= _cogl_alpha_test_ref)
|
2008-06-24 16:21:40 +00:00
|
|
|
discard;
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_alpha_equal ***/
|
2010-07-23 16:46:41 +00:00
|
|
|
if (gl_FragColor.a != _cogl_alpha_test_ref)
|
2008-06-24 16:21:40 +00:00
|
|
|
discard;
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_alpha_lequal ***/
|
2010-07-23 16:46:41 +00:00
|
|
|
if (gl_FragColor.a > _cogl_alpha_test_ref)
|
2008-06-24 16:21:40 +00:00
|
|
|
discard;
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_alpha_greater ***/
|
2010-07-23 16:46:41 +00:00
|
|
|
if (gl_FragColor.a <= _cogl_alpha_test_ref)
|
2008-06-24 16:21:40 +00:00
|
|
|
discard;
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_alpha_notequal ***/
|
2010-07-23 16:46:41 +00:00
|
|
|
if (gl_FragColor.a == _cogl_alpha_test_ref)
|
2008-06-24 16:21:40 +00:00
|
|
|
discard;
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_alpha_gequal ***/
|
2010-07-23 16:46:41 +00:00
|
|
|
if (gl_FragColor.a < _cogl_alpha_test_ref)
|
2008-06-24 16:21:40 +00:00
|
|
|
discard;
|
|
|
|
|
2010-06-11 13:36:38 +00:00
|
|
|
/*** _cogl_fixed_fragment_shader_end ***/
|
2008-05-27 17:42:50 +00:00
|
|
|
}
|
2010-07-23 16:46:41 +00:00
|
|
|
|