forked from id-Software/Quake-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvertexTexture2D.hlsl
57 lines (45 loc) · 1.39 KB
/
vertexTexture2D.hlsl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
////////////////////////////////////////////////////////////////////////////////
// Filename: vertexTexture2D.hlsl
// http://rastertek.com/dx11tut05.html
////////////////////////////////////////////////////////////////////////////////
/////////////
// GLOBALS //
/////////////
cbuffer MatrixBuffer
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
//////////////
// TYPEDEFS //
//////////////
struct VertexInputType
{
float4 position : POSITION;
float4 color : COLOR;
float2 tex : TEXCOORD0;
};
struct PixelInputType
{
float4 position : SV_POSITION;
float4 color : COLOR;
float2 tex : TEXCOORD0;
};
////////////////////////////////////////////////////////////////////////////////
// Vertex Shader
////////////////////////////////////////////////////////////////////////////////
PixelInputType VS_Entry(VertexInputType input)
{
PixelInputType output;
// Change the position vector to be 4 units for proper matrix calculations.
input.position.w = 1.0f;
// Calculate the position of the vertex against the world, view, and projection matrices.
//output.position = mul(input.position, worldMatrix);
//output.position = mul(output.position, viewMatrix);
output.position = mul(input.position, projectionMatrix);
output.color = input.color;
// Store the texture coordinates for the pixel shader.
output.tex = input.tex;
return output;
}