simplescreen.fx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //-----------------------------------------------------------------------------
  2. // SimpleScreen.fx
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. struct VS_INPUT
  8. {
  9. float4 ObjectPos: POSITION;
  10. float4 VertexColor: COLOR;
  11. };
  12. struct VS_OUTPUT
  13. {
  14. float4 ScreenPos: POSITION;
  15. float4 VertexColor: COLOR;
  16. };
  17. VS_OUTPUT SimpleScreenVS(VS_INPUT In)
  18. {
  19. VS_OUTPUT Out;
  20. //Move to screen space. For the starfield coordinates are already transformed.
  21. Out.ScreenPos.x = (In.ObjectPos.x - 640) / 640;
  22. Out.ScreenPos.y = (In.ObjectPos.y - 360) / 360;
  23. Out.ScreenPos.z = 0;
  24. Out.ScreenPos.w = 1;
  25. Out.VertexColor = In.VertexColor;
  26. return Out;
  27. }
  28. float4 SimpleScreenPS(float4 color : COLOR0) : COLOR0
  29. {
  30. return color;
  31. }
  32. //--------------------------------------------------------------//
  33. // Technique Section for Simple screen transform
  34. //--------------------------------------------------------------//
  35. technique SimpleScreen
  36. {
  37. pass Single_Pass
  38. {
  39. VertexShader = compile vs_1_1 SimpleScreenVS();
  40. PixelShader = compile ps_2_0 SimpleScreenPS();
  41. }
  42. }