SpriteLine.bsl 980 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. technique SpriteLine
  2. {
  3. blend
  4. {
  5. target
  6. {
  7. enabled = true;
  8. color = { srcA, srcIA, add };
  9. writemask = RGB;
  10. };
  11. };
  12. depth
  13. {
  14. read = false;
  15. write = false;
  16. };
  17. raster
  18. {
  19. multisample = false; // This controls line rendering algorithm
  20. lineaa = false;
  21. };
  22. code
  23. {
  24. struct VStoFS
  25. {
  26. float4 position : SV_POSITION;
  27. };
  28. cbuffer VertParams
  29. {
  30. float invViewportWidth;
  31. float invViewportHeight;
  32. float4x4 worldTransform;
  33. };
  34. struct VertexInput
  35. {
  36. float2 position : POSITION;
  37. };
  38. VStoFS vsmain(VertexInput input)
  39. {
  40. float4 tfrmdPos = mul(worldTransform, float4(input.position, 0, 1));
  41. float tfrmdX = -1.0f + (tfrmdPos.x * invViewportWidth);
  42. float tfrmdY = 1.0f - (tfrmdPos.y * invViewportHeight);
  43. VStoFS output;
  44. output.position = float4(tfrmdX, tfrmdY, 0, 1);
  45. return output;
  46. }
  47. cbuffer VertParams
  48. {
  49. float4 tint;
  50. };
  51. float4 fsmain(VStoFS input) : SV_Target
  52. {
  53. return tint;
  54. }
  55. };
  56. };