Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
39 lines (31 loc) · 820 Bytes

SimpleVertexShader.hlsl

File metadata and controls

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