This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
/
SimpleVertexShader.hlsl
39 lines (31 loc) · 820 Bytes
1
2
#pragma pack_matrix( row_major )
3
4
5
cbuffer SDL_VertexShaderConstants : register(b0)
{
6
matrix view;
7
8
9
matrix projection;
};
10
11
struct VertexShaderInput
{
12
13
float3 pos : POSITION;
float2 tex : TEXCOORD0;
14
float4 color : COLOR0;
15
16
17
18
};
struct VertexShaderOutput
{
19
20
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
21
float4 color : COLOR0;
22
23
24
25
};
VertexShaderOutput main(VertexShaderInput input)
{
26
VertexShaderOutput output;
27
28
29
float4 pos = float4(input.pos, 1.0f);
// Transform the vertex position into projected space.
30
pos = mul(pos, view);
31
32
33
pos = mul(pos, projection);
output.pos = pos;
34
// Pass through texture coordinates and color values without transformation
35
output.tex = input.tex;
36
output.color = input.color;
37
38
return output;
39
}