1// [config]
2// expect_result: pass
3// glsl_version: 1.10
4//
5// [end config]
6
7/*
8 * GStreamer
9 * Copyright (C) 2008 Cyril Comparon <cyril.comparon@gmail.com>
10 * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20 * Library General Public License for more details.
21 *
22 * You should have received a copy of the GNU Library General Public
23 * License along with this library; if not, write to the
24 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 * Boston, MA 02111-1307, USA.
26 */
27
28attribute vec3 aTangent;
29
30varying vec3 vNormal;
31varying vec3 vTangent;
32varying vec3 vVertexToLight0;
33varying vec3 vVertexToLight1;
34
35void main()
36{
37  // transform the vertex
38  gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;
39
40  // transform the normal and the tangent to scene coords
41  vNormal = normalize(gl_NormalMatrix * gl_Normal);
42  vTangent = normalize(gl_NormalMatrix * aTangent);
43
44  // transforming the vertex position to modelview-space
45  //const vec4 vertexInSceneCoords = gl_ModelViewMatrix * gl_Vertex;
46
47  // calculate the vector from the vertex position to the light position
48  vVertexToLight0 = normalize(gl_LightSource[0].position).xyz;
49  vVertexToLight1 = normalize(gl_LightSource[1].position).xyz;
50
51  // transit vertex color
52  gl_FrontColor = gl_BackColor = gl_Color;
53
54  // use the two first sets of texture coordinates in the fragment shader
55  gl_TexCoord[0] = gl_MultiTexCoord0;
56  gl_TexCoord[1] = gl_MultiTexCoord1;
57}
58