D3D11_VertexShader.hlsl 798 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #pragma pack_matrix( row_major )
  2. cbuffer VertexShaderConstants : register(b0)
  3. {
  4. matrix model;
  5. matrix projectionAndView;
  6. };
  7. struct VertexShaderInput
  8. {
  9. float3 pos : POSITION;
  10. float2 tex : TEXCOORD0;
  11. float4 color : COLOR0;
  12. };
  13. struct VertexShaderOutput
  14. {
  15. float4 pos : SV_POSITION;
  16. float2 tex : TEXCOORD0;
  17. float4 color : COLOR0;
  18. };
  19. VertexShaderOutput main(VertexShaderInput input)
  20. {
  21. VertexShaderOutput output;
  22. float4 pos = float4(input.pos, 1.0f);
  23. // Transform the vertex position into projected space.
  24. pos = mul(pos, model);
  25. pos = mul(pos, projectionAndView);
  26. output.pos = pos;
  27. // Pass through texture coordinates and color values without transformation
  28. output.tex = input.tex;
  29. output.color = input.color;
  30. return output;
  31. }