SpriteLine.bsl 979 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 GUIParams
  29. {
  30. float4x4 gWorldTransform;
  31. float gInvViewportWidth;
  32. float gInvViewportHeight;
  33. float gViewportYFlip;
  34. float4 gTint;
  35. }
  36. struct VertexInput
  37. {
  38. float2 position : POSITION;
  39. };
  40. VStoFS vsmain(VertexInput input)
  41. {
  42. float4 tfrmdPos = mul(gWorldTransform, float4(input.position, 0, 1));
  43. float tfrmdX = -1.0f + (tfrmdPos.x * gInvViewportWidth);
  44. float tfrmdY = 1.0f - (tfrmdPos.y * gInvViewportHeight);
  45. VStoFS output;
  46. output.position = float4(tfrmdX, tfrmdY, 0, 1);
  47. return output;
  48. }
  49. float4 fsmain(VStoFS input) : SV_Target
  50. {
  51. return gTint;
  52. }
  53. };
  54. };