~ubuntu-branches/ubuntu/precise/clutter-1.0/precise

« back to all changes in this revision

Viewing changes to clutter/cogl/gles/cogl-fixed-fragment-shader.c

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort
  • Date: 2010-03-21 13:27:56 UTC
  • mto: (2.1.3 experimental) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20100321132756-nf8yd30yxo3zzwcm
Tags: upstream-1.2.2
ImportĀ upstreamĀ versionĀ 1.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Cogl
3
 
 *
4
 
 * An object oriented GL/GLES Abstraction/Utility Layer
5
 
 *
6
 
 * Copyright (C) 2008,2009 Intel Corporation.
7
 
 *
8
 
 * This library is free software; you can redistribute it and/or
9
 
 * modify it under the terms of the GNU Lesser General Public
10
 
 * License as published by the Free Software Foundation; either
11
 
 * version 2 of the License, or (at your option) any later version.
12
 
 *
13
 
 * This library is distributed in the hope that it will be useful,
14
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
 
 * Lesser General Public License for more details.
17
 
 *
18
 
 * You should have received a copy of the GNU Lesser General Public
19
 
 * License along with this library; if not, write to the
20
 
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
 
 * Boston, MA 02111-1307, USA.
22
 
 */
23
 
 
24
 
  ;
25
 
const char cogl_fixed_fragment_shader_variables_start[] =
26
 
  "\n"
27
 
  "/* There is no default precision for floats in fragment shaders in\n"
28
 
  "   GLES 2 so we need to define one */\n"
29
 
  "precision highp float;\n"
30
 
  "\n"
31
 
  ;
32
 
const char cogl_fixed_fragment_shader_inputs[] =
33
 
  "\n"
34
 
  "/* Inputs from the vertex shader */\n"
35
 
  "varying vec4       frag_color;\n"
36
 
  "varying float      fog_amount;\n"
37
 
  "\n"
38
 
  ;
39
 
const char cogl_fixed_fragment_shader_texturing_options[] =
40
 
  "\n"
41
 
  "/* Texturing options */\n"
42
 
  "\n"
43
 
  ;
44
 
const char cogl_fixed_fragment_shader_fogging_options[] =
45
 
  "\n"
46
 
  "/* Fogging options */\n"
47
 
  "uniform vec4       fog_color;\n"
48
 
  "\n"
49
 
  "/* Alpha test options */\n"
50
 
  "uniform float      alpha_test_ref;\n"
51
 
  "\n"
52
 
  ;
53
 
const char cogl_fixed_fragment_shader_main_declare[] =
54
 
  "\n"
55
 
  "void\n"
56
 
  "main (void)\n"
57
 
  "{\n"
58
 
  ;
59
 
const char cogl_fixed_fragment_shader_main_start[] =
60
 
  "\n"
61
 
  "\n"
62
 
  ;
63
 
const char cogl_fixed_fragment_shader_fog[] =
64
 
  "\n"
65
 
  "  /* Mix the calculated color with the fog color */\n"
66
 
  "  gl_FragColor.rgb = mix (fog_color.rgb, gl_FragColor.rgb, fog_amount);\n"
67
 
  "\n"
68
 
  "  /* Alpha testing */\n"
69
 
  "\n"
70
 
  ;
71
 
const char cogl_fixed_fragment_shader_alpha_never[] =
72
 
  "  discard;\n"
73
 
  ;
74
 
const char cogl_fixed_fragment_shader_alpha_less[] =
75
 
  "  if (gl_FragColor.a >= alpha_test_ref)\n"
76
 
  "    discard;\n"
77
 
  ;
78
 
const char cogl_fixed_fragment_shader_alpha_equal[] =
79
 
  "  if (gl_FragColor.a != alpha_test_ref)\n"
80
 
  "    discard;\n"
81
 
  ;
82
 
const char cogl_fixed_fragment_shader_alpha_lequal[] =
83
 
  "  if (gl_FragColor.a > alpha_test_ref)\n"
84
 
  "    discard;\n"
85
 
  ;
86
 
const char cogl_fixed_fragment_shader_alpha_greater[] =
87
 
  "  if (gl_FragColor.a <= alpha_test_ref)\n"
88
 
  "    discard;\n"
89
 
  ;
90
 
const char cogl_fixed_fragment_shader_alpha_notequal[] =
91
 
  "  if (gl_FragColor.a == alpha_test_ref)\n"
92
 
  "    discard;\n"
93
 
  ;
94
 
const char cogl_fixed_fragment_shader_alpha_gequal[] =
95
 
  "  if (gl_FragColor.a < alpha_test_ref)\n"
96
 
  "    discard;\n"
97
 
  "\n"
98
 
  ;
99
 
const char cogl_fixed_fragment_shader_end[] =
100
 
  "}\n"
101
 
  ;