normalGen.sha 629 B

1234567891011121314151617181920212223
  1. //Cg
  2. //
  3. //Cg profile arbvp1 arbfp1
  4. void vshader(float4 vtx_position : POSITION,
  5. float3 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, float4(vtx_normal, 0));
  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.rgb + float3(0.5, 0.5, 0.5);
  20. o_color.a = 1;
  21. }