//
// VBO Array Debug CGFX Shader
//
float debugSelector
<
string UIName = "Diffuse/UV/Normal/Tangent/Binormal";
string UIWidget = "slider";
float UIMin = 0.0;
float UIMax = 4.0;
float UIStep = 0.1;
> = 1.0;
float3 diffuseColor
<
string UIName = "Diffuse Color";
string Type = "Color";
> = {1.0,1.0,1.0};
float4 light1Dir : DIRECTION
<
string UIName = "Light 1 - Directional Light";
string Space = "World";
> = {0.0,-1.0,-1.0,0.0};
float4x4 World : World < string UIWidget = "None"; >;
float4x4 WorldView : WorldView < string UIWidget = "None"; >;
float4x4 WorldViewProjection : WorldViewProjection < string UIWidget = "None"; >;
float4x4 WorldInverseTranspose : WorldInverseTranspose < string UIWidget = "None"; >;
float4x4 ViewInverse : ViewInverse < string UIWidget = "None"; >;
struct app2vert {
float4 Position : POSITION;
float4 Normal : NORMAL;
float4 UV : TEXCOORD0;
float4 tex_du : TEXCOORD1;
float4 tex_dv : TEXCOORD2;
};
struct vert2pixel {
float4 hpos : POSITION;
float3 Normal : TEXCOORD0;
float3 TexCoord : TEXCOORD1;
float3 tex_du : TEXCOORD2;
float3 tex_dv : TEXCOORD3;
};
vert2pixel VS(app2vert IN)
{
vert2pixel OUT;
OUT.hpos = mul(WorldViewProjection, IN.Position);
OUT.Normal = IN.Normal.xyz;
OUT.tex_du = IN.tex_du.xyz;
OUT.tex_dv = IN.tex_dv.xyz;
OUT.TexCoord = IN.UV;
return OUT;
}
float4 PSBasic (vert2pixel IN) : COLOR
{
float3 shading;
if (debugSelector >= 4)
shading = IN.TexCoord;
else if (debugSelector >= 3)
shading = normalize(IN.tex_dv) * 0.5 + 0.5;
else if (debugSelector >= 2)
shading = normalize(IN.tex_du) * 0.5 + 0.5;
else if (debugSelector >= 1)
shading = normalize(IN.Normal) * 0.5 + 0.5;
else
shading = saturate(dot(normalize(IN.Normal),normalize(-light1Dir.xyz))) * diffuseColor;
return float4(shading,1.0);
}
technique Basic
{
pass P0
{
CullFaceEnable=false;
DepthTestEnable=true;
DepthMask = true;
DepthFunc = LEqual;
VertexProgram = compile gp4vp VS();
FragmentProgram = compile gp4fp PSBasic();
}
}