Font.vs 807 B

1234567891011121314151617181920212223242526272829303132333435
  1. cbuffer PerFrameBuffer
  2. {
  3. matrix worldMatrix;
  4. matrix viewMatrix;
  5. matrix projectionMatrix;
  6. };
  7. struct VertexInputType
  8. {
  9. float4 position : POSITION;
  10. float2 tex : TEXCOORD0;
  11. };
  12. struct PixelInputType
  13. {
  14. float4 position : SV_POSITION;
  15. float2 tex : TEXCOORD0;
  16. };
  17. PixelInputType FontVertexShader(VertexInputType input)
  18. {
  19. PixelInputType output;
  20. // Change the position vector to be 4 units for proper matrix calculations.
  21. input.position.w = 1.0f;
  22. // Calculate the position of the vertex against the world, view, and projection matrices.
  23. output.position = mul(input.position, worldMatrix);
  24. output.position = mul(output.position, viewMatrix);
  25. output.position = mul(output.position, projectionMatrix);
  26. // Store the texture coordinates for the pixel shader.
  27. output.tex = input.tex;
  28. return output;
  29. }