#include <define>
#include <transform>
#include <sun>
#include <lights>
#include <fog>
#include <normal>
Texture entSkin1; // Color
float4 vecSkill41;
float4 vecAmbient;
sampler sColor = sampler_state { Texture = <entSkin1>; MipFilter = Linear; };
//////////////////////////////////////////////////////////////////////
struct out_terraintex3 // Output to the pixelshader fragment
{
float4 Pos : POSITION;
float4 Color : COLOR0;
float Fog : FOG;
float2 TexCoord : TEXCOORD0;
};
out_terraintex3 vs_terraintex3(
float4 inPos : POSITION,
float3 inNormal : NORMAL,
float2 inTexCoord0 : TEXCOORD0)
{
out_terraintex3 Out;
Out.Pos = DoTransform(inPos); // transform to screen coordinates
// rotate and normalize the normal
float3 N = DoNormal(inNormal);
float3 P = mul(inPos,matWorld);
Out.Color = vecAmbient; // Add ambient and sun light
for (int i=0; i<8; i++) // Add 8 dynamic lights
Out.Color += DoLight(P,N,i);
Out.Fog = DoFog(inPos); // Add fog
// scale the texture coordinates for the masked textures
Out.TexCoord = inTexCoord0.xy;
return Out;
}
float4 ps_terraintex3(out_terraintex3 In): COLOR
{
float4 Color = tex2D(sColor,In.TexCoord);
Color = Color * In.Color + Color * Color.a;
Color.a = 1.0f; // prevent transparency
return Color;
}
technique terraintex3_13
{
pass one
{
sampler[0] = (sColor);
ZWriteEnable = true;
ZEnable = true;
ZFunc = Less;
AlphaBlendEnable = false;
FillMode = Solid;
CullMode = CCW;
VertexShader = compile vs_2_0 vs_terraintex3();
PixelShader = compile ps_2_0 ps_terraintex3();
}
}
// fallback if nothing works
technique fallback { pass one { } }