const float4x4 matWorldViewProj;
const float4x4 matWorld;
texture entSkin1;
// Color map sampler
sampler ColorMapSampler = sampler_state
{
Texture = <entSkin1>;
};
// Vertex Shader:
void DiffuseVS(
in float4 InPos: POSITION,
in float3 InNormal: NORMAL,
in float2 InTex: TEXCOORD0,
out float4 OutPos: POSITION,
out float2 OutTex: TEXCOORD0,
out float3 OutNormal: TEXCOORD1)
{
float distance = length(mul(InPos, matWorldViewProj));
OutPos = mul(InPos, matWorldViewProj);
OutPos *= distance + (OutPos.w * (0.1)) / distance / 2;
//OutNormal = distance + (OutPos.w * (0.1)) / distance / 2;
OutNormal = normalize(mul(InNormal, matWorld));
OutTex = InTex;
}
// Pixel Shader:
float4 DiffusePS(
in float2 InTex: TEXCOORD0,
in float3 InNormal: TEXCOORD1): COLOR
{
return tex2D(ColorMapSampler, InTex);
}
// Technique:
technique AffineTechnique
{
pass P0
{
VertexShader = compile vs_2_0 DiffuseVS();
PixelShader = compile ps_2_0 DiffusePS();
}
}