const float4x4 matWorldViewProj;
const float4x4 matWorld;
const float fAmbient;
const float4 vecSunDir;
const float4x4 matTexture;
texture entSkin1;
sampler ColorMapSampler = sampler_state
{
Texture = <entSkin1>;
AddressU = Wrap;
AddressV = Wrap;
};
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)
{
OutPos = mul(InPos, matWorldViewProj);
OutNormal = mul(InNormal, matWorld);
OutTex = InTex+float2(matTexture._m20,matTexture._m21);
}
float4 DiffusePS(
in float2 InTex: TEXCOORD0,
in float3 InNormal: TEXCOORD1): COLOR
{
InNormal = normalize(InNormal);
float Diffuse = saturate(dot(-vecSunDir, InNormal))*0.7+0.3;
float4 Color = tex2D(ColorMapSampler, InTex);
float4 final = Color*Diffuse;
return (1+fAmbient) * final;
}
technique DiffuseTechnique
{
pass P0
{
cullmode = none;
VertexShader = compile vs_2_0 DiffuseVS();
PixelShader = compile ps_2_0 DiffusePS();
}
}