Splitscreen.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*-----------------------------------------------------------.
  2. / Splitscreen /
  3. '-----------------------------------------------------------*/
  4. float4 SplitscreenPass( float4 colorInput, float2 tex )
  5. {
  6. // -- Vertical 50/50 split --
  7. #if splitscreen_mode == 1
  8. return (tex.x < 0.5) ? myTex2D(s0, tex) : colorInput;
  9. #endif
  10. // -- Vertical 25/50/25 split --
  11. #if splitscreen_mode == 2
  12. //Calculate the distance from center
  13. float distance = abs(tex.x - 0.5);
  14. //Further than 1/4 away from center?
  15. distance = saturate(distance - 0.25);
  16. return distance ? myTex2D(s0, tex) : colorInput;
  17. #endif
  18. // -- Vertical 50/50 angled split --
  19. #if splitscreen_mode == 3
  20. //Calculate the distance from center
  21. float distance = ((tex.x - 3.0/8.0) + (tex.y * 0.25));
  22. //Further than 1/4 away from center?
  23. distance = saturate(distance - 0.25);
  24. return distance ? colorInput : myTex2D(s0, tex);
  25. #endif
  26. // -- Horizontal 50/50 split --
  27. #if splitscreen_mode == 4
  28. return (tex.y < 0.5) ? myTex2D(s0, tex) : colorInput;
  29. #endif
  30. // -- Horizontal 25/50/25 split --
  31. #if splitscreen_mode == 5
  32. //Calculate the distance from center
  33. float distance = abs(tex.y - 0.5);
  34. //Further than 1/4 away from center?
  35. distance = saturate(distance - 0.25);
  36. return distance ? myTex2D(s0, tex) : colorInput;
  37. #endif
  38. // -- Vertical 50/50 curvy split --
  39. #if splitscreen_mode == 6
  40. //Calculate the distance from center
  41. float distance = (tex.x - 0.25) + (sin(tex.y * 10)*0.10);
  42. //Further than 1/4 away from center?
  43. distance = saturate(distance - 0.25);
  44. return distance ? colorInput : myTex2D(s0, tex);
  45. #endif
  46. }