-
Notifications
You must be signed in to change notification settings - Fork 1
/
colour_vs.hlsl
46 lines (36 loc) · 1.08 KB
/
colour_vs.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
// colour vertex shader
// Simple geometry pass
// texture coordinates and normals will be ignored.
cbuffer MatrixBuffer : register(b0)
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
struct InputType
{
float4 position : POSITION;
float4 colour : COLOR;
};
struct OutputType
{
float4 position : SV_POSITION;
float4 colour : COLOR;
};
OutputType main(InputType input)
{
OutputType 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(output.position, projectionMatrix);
// Store the texture coordinates for the pixel shader.
//output.tex = input.tex;
// Store normals for the pixel shader
//output.normal = mul(input.normal, (float3x3)worldMatrix);
//output.normal = normalize(output.normal);
output.colour = input.colour;
return output;
}