home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GameStar 2006 April
/
Gamestar_83_2006-04_dvd.iso
/
Dema
/
demowot_english.exe
/
InfDX
/
Shaders
/
sprite-gradient-1-pixel.hlsl
< prev
next >
Wrap
Text File
|
2005-10-06
|
828b
|
43 lines
struct VS_OUTPUT
{
#if TDX_SHADERFLAG_VERTEXCOLOR
float4 Diffuse : COLOR0;
#endif
#if TDX_SHADERFLAG_VERTEXUV
float2 UV : TEXCOORD0;
#endif
};
half4 TDX_CONST_MODELCOLOR;
sampler s_diff : register(s0);
sampler s_spec : register(s1);
half4 main(VS_OUTPUT In) : COLOR
{
half4 FinalColor;
#if TDX_SHADERFLAG_VERTEXUV
half4 Diff = tex2D(s_diff, In.UV);
half4 Spec = tex2D(s_spec, In.UV);
#else
half4 Diff = 1;
half4 Spec = 1;
#endif
if ( In.Diffuse.r == 1.0f && In.Diffuse.g == 1.0f && In.Diffuse.b == 1.0f )
{
FinalColor = Diff;
}
else
{
half4 r1 = dot(Diff.rgb, half3(0.299,0.587,0.114)); //fekete feher
float spec = In.Diffuse.a+Spec.a;
half4 r0 = r1*In.Diffuse;
FinalColor.rgb = spec>1 ? r0 : Diff;
FinalColor.a =Diff.a;
}
return FinalColor;
}