normalGen.sha 616 B

12345678910111213141516171819202122232425
  1. //Cg
  2. //
  3. //Cg profile arbvp1 arbfp1
  4. void vshader(float4 vtx_position : POSITION,
  5. float4 vtx_normal : NORMAL,
  6. out float4 l_position : POSITION,
  7. out float3 l_color : TEXCOORD0,
  8. uniform float4x4 mat_modelproj,
  9. uniform float4x4 itp_modelview)
  10. {
  11. l_position=mul(mat_modelproj, vtx_position);
  12. l_color=(float3)mul(itp_modelview, vtx_normal);
  13. }
  14. void fshader(float3 l_color: TEXCOORD0,
  15. out float4 o_color: COLOR)
  16. {
  17. l_color = normalize(l_color);
  18. l_color = l_color/2;
  19. o_color.rgb = l_color + float4(0.5, 0.5, 0.5, 0.5);
  20. o_color.a = 1;
  21. }