78 lines
2.2 KiB
Text
78 lines
2.2 KiB
Text
/// ============================================================================
|
|
/*
|
|
Copyright (C) 2004 Robert Beckebans <trebor_7@users.sourceforge.net>
|
|
Please see the file "AUTHORS" for a list of contributors
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
*/
|
|
/// ============================================================================
|
|
|
|
|
|
struct cg_app2vertex
|
|
{
|
|
float4 position : POSITION;
|
|
float4 tex0 : ATTR8;
|
|
|
|
float3 tangent : ATTR9;
|
|
float3 binormal : ATTR10;
|
|
float3 normal : ATTR11;
|
|
};
|
|
|
|
struct cg_vertex2fragment
|
|
{
|
|
float4 hposition : POSITION;
|
|
|
|
float4 position : TEXCOORD0;
|
|
float4 tex_diffuse_bump : TEXCOORD1;
|
|
float4 tex_specular : TEXCOORD2;
|
|
float4 tex_atten_xy_z : TEXCOORD3;
|
|
|
|
float3 tangent : TEXCOORD4;
|
|
float3 binormal : TEXCOORD5;
|
|
float3 normal : TEXCOORD6;
|
|
};
|
|
|
|
|
|
|
|
cg_vertex2fragment main(cg_app2vertex IN)
|
|
{
|
|
cg_vertex2fragment OUT;
|
|
|
|
// transform vertex position into homogenous clip-space
|
|
OUT.hposition = mul(glstate.matrix.mvp, IN.position);
|
|
|
|
// assign position in object space
|
|
OUT.position = IN.position;
|
|
|
|
// transform texcoords
|
|
OUT.tex_diffuse_bump.xy = mul(glstate.matrix.texture[0], IN.tex0).xy;
|
|
|
|
// transform texcoords
|
|
OUT.tex_diffuse_bump.zw = mul(glstate.matrix.texture[1], IN.tex0).xy;
|
|
|
|
// transform texcoords
|
|
OUT.tex_specular = mul(glstate.matrix.texture[2], IN.tex0);
|
|
|
|
// transform vertex position into light space
|
|
OUT.tex_atten_xy_z = mul(glstate.matrix.texture[3], IN.position);
|
|
|
|
// assign tangent space vectors
|
|
OUT.tangent = IN.tangent;
|
|
OUT.binormal = IN.binormal;
|
|
OUT.normal = IN.normal;
|
|
|
|
return OUT;
|
|
}
|