1 /// ============================================================================
3 Copyright (C) 2004 Robert Beckebans <trebor_7@users.sourceforge.net>
4 Please see the file "AUTHORS" for a list of contributors
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU 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.
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.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU 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.
21 /// ============================================================================
26 float4 position : POSITION;
29 float3 tangent : ATTR9;
30 float3 binormal : ATTR10;
31 float3 normal : ATTR11;
34 struct cg_vertex2fragment
36 float4 hposition : POSITION;
38 float4 position : TEXCOORD0;
39 float4 tex_diffuse_bump : TEXCOORD1;
40 float4 tex_specular : TEXCOORD2;
41 float4 tex_atten_xy_z : TEXCOORD3;
43 float3 tangent : TEXCOORD4;
44 float3 binormal : TEXCOORD5;
45 float3 normal : TEXCOORD6;
50 cg_vertex2fragment main(cg_app2vertex IN)
52 cg_vertex2fragment OUT;
54 // transform vertex position into homogenous clip-space
55 OUT.hposition = mul(glstate.matrix.mvp, IN.position);
57 // assign position in object space
58 OUT.position = IN.position;
60 // transform texcoords
61 OUT.tex_diffuse_bump.xy = mul(glstate.matrix.texture[0], IN.tex0).xy;
63 // transform texcoords
64 OUT.tex_diffuse_bump.zw = mul(glstate.matrix.texture[1], IN.tex0).xy;
66 // transform texcoords
67 OUT.tex_specular = mul(glstate.matrix.texture[2], IN.tex0);
69 // transform vertex position into light space
70 OUT.tex_atten_xy_z = mul(glstate.matrix.texture[3], IN.position);
72 // assign tangent space vectors
73 OUT.tangent = IN.tangent;
74 OUT.binormal = IN.binormal;
75 OUT.normal = IN.normal;