SimpleVertexShader.hlsl 727 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #if !defined(FLAGS_ADDED)
  2. # error FLAGS_ADDED not defined
  3. #endif
  4. cbuffer ModelViewProjectionConstantBuffer : register(b0)
  5. {
  6. matrix model;
  7. matrix view;
  8. matrix projection;
  9. };
  10. struct VertexShaderInput
  11. {
  12. float3 pos : POSITION;
  13. float3 color : COLOR0;
  14. };
  15. struct VertexShaderOutput
  16. {
  17. float4 pos : SV_POSITION;
  18. float3 color : COLOR0;
  19. };
  20. VertexShaderOutput mainVS(VertexShaderInput input)
  21. {
  22. VertexShaderOutput output;
  23. float4 pos = float4(input.pos, 1.0f);
  24. // Transform the vertex position into projected space.
  25. pos = mul(pos, model);
  26. pos = mul(pos, view);
  27. pos = mul(pos, projection);
  28. output.pos = pos;
  29. // Pass through the color without modification.
  30. output.color = input.color;
  31. return output;
  32. }