4
* An object oriented GL/GLES Abstraction/Utility Layer
6
* Copyright (C) 2008,2009 Intel Corporation.
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.
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.
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.
25
const char cogl_fixed_vertex_shader_per_vertex_attribs[] =
27
"/* Per vertex attributes */\n"
28
"attribute vec4 vertex_attrib;\n"
29
"attribute vec4 color_attrib;\n"
32
const char cogl_fixed_vertex_shader_transform_matrices[] =
34
"/* Transformation matrices */\n"
35
"uniform mat4 modelview_matrix;\n"
36
"uniform mat4 mvp_matrix; /* combined modelview and projection matrix */\n"
39
const char cogl_fixed_vertex_shader_output_variables[] =
41
"/* Outputs to the fragment shader */\n"
42
"varying vec4 frag_color;\n"
43
"varying float fog_amount;\n"
46
const char cogl_fixed_vertex_shader_fogging_options[] =
48
"/* Fogging options */\n"
49
"uniform float fog_density;\n"
50
"uniform float fog_start;\n"
51
"uniform float fog_end;\n"
54
const char cogl_fixed_vertex_shader_main_start[] =
59
" vec4 transformed_tex_coord;\n"
61
" /* Calculate the transformed position */\n"
62
" gl_Position = mvp_matrix * vertex_attrib;\n"
64
" /* Calculate the transformed texture coordinate */\n"
67
const char cogl_fixed_vertex_shader_frag_color_start[] =
69
" /* Pass the interpolated vertex color on to the fragment shader */\n"
70
" frag_color = color_attrib;\n"
73
const char cogl_fixed_vertex_shader_fog_start[] =
75
" /* Estimate the distance from the eye using just the z-coordinate to\n"
76
" use as the fog coord */\n"
77
" vec4 eye_coord = modelview_matrix * vertex_attrib;\n"
78
" float fog_coord = abs (eye_coord.z / eye_coord.w);\n"
80
" /* Calculate the fog amount per-vertex and interpolate it for the\n"
81
" fragment shader */\n"
84
const char cogl_fixed_vertex_shader_fog_exp[] =
85
" fog_amount = exp (-fog_density * fog_coord);\n"
87
const char cogl_fixed_vertex_shader_fog_exp2[] =
88
" fog_amount = exp (-fog_density * fog_coord\n"
89
" * fog_density * fog_coord);\n"
91
const char cogl_fixed_vertex_shader_fog_linear[] =
92
" fog_amount = (fog_end - fog_coord) / (fog_end - fog_start);\n"
95
const char cogl_fixed_vertex_shader_fog_end[] =
96
" fog_amount = clamp (fog_amount, 0.0, 1.0);\n"
99
const char cogl_fixed_vertex_shader_end[] =