]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - setup/data/tools/gl/lighting_DBS_omni_vp.glsl
ok
[xonotic/netradiant.git] / setup / data / tools / gl / lighting_DBS_omni_vp.glsl
1 /// ============================================================================
2 /*
3 Copyright (C) 2004 Robert Beckebans <trebor_7@users.sourceforge.net>
4 Please see the file "CONTRIBUTORS" for a list of contributors
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
14
15 See the GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 */
21 /// ============================================================================
22
23 attribute vec4          attr_TexCoord0;
24 attribute vec3          attr_Tangent;
25 attribute vec3          attr_Binormal;
26
27 varying vec3            var_vertex;
28 varying vec4            var_tex_diffuse_bump;
29 varying vec2            var_tex_specular;
30 varying vec4            var_tex_atten_xy_z;
31 varying mat3            var_mat_os2ts;
32
33 void    main()
34 {
35         // transform vertex position into homogenous clip-space
36         gl_Position = ftransform();
37         
38         // assign position in object space
39         var_vertex = gl_Vertex.xyz;
40                 
41         // transform texcoords into diffusemap texture space
42         var_tex_diffuse_bump.st = (gl_TextureMatrix[0] * attr_TexCoord0).st;
43         
44         // transform texcoords into bumpmap texture space
45         var_tex_diffuse_bump.pq = (gl_TextureMatrix[1] * attr_TexCoord0).st;
46         
47         // transform texcoords into specularmap texture space
48         var_tex_specular = (gl_TextureMatrix[2] * attr_TexCoord0).st;
49         
50         // calc light xy,z attenuation in light space
51         var_tex_atten_xy_z = gl_TextureMatrix[3] * gl_Vertex;
52
53         
54         // construct object-space-to-tangent-space 3x3 matrix
55         var_mat_os2ts = mat3(   attr_Tangent.x, attr_Binormal.x, gl_Normal.x,
56                                 attr_Tangent.y, attr_Binormal.y, gl_Normal.y,
57                                 attr_Tangent.z, attr_Binormal.z, gl_Normal.z    );
58 }