historical/toontown-classic.git/panda/samples/cartoon-shader/lightingGen.sha

30 lines
828 B
Text
Raw Normal View History

2024-01-16 11:20:27 -06:00
//Cg
//
//Cg profile arbvp1 arbfp1
void vshader(float4 vtx_position : POSITION,
float3 vtx_normal : NORMAL,
float4 vtx_color : COLOR,
out float4 l_position : POSITION,
out float4 l_brite : TEXCOORD0,
out float4 l_color : COLOR,
uniform float4 mspos_light,
uniform float4x4 mat_modelproj)
{
l_position = mul(mat_modelproj, vtx_position);
float3 N = normalize(vtx_normal);
float3 lightVector = normalize(mspos_light - vtx_position);
l_brite = max(dot(N,lightVector), 0);
l_color = vtx_color;
}
void fshader(float4 l_brite : TEXCOORD0,
float4 l_color : COLOR,
out float4 o_color : COLOR)
{
if (l_brite.x<0.5) l_brite=0.8;
else l_brite=1.2;
o_color=l_brite * l_color;
}