-
Notifications
You must be signed in to change notification settings - Fork 0
/
Snow_Ground_VertexShader.hlsl
59 lines (43 loc) · 1.26 KB
/
Snow_Ground_VertexShader.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
58
59
struct VS_INPUT
{
float4 position: POSITION0;
float2 texcoord: TEXCOORD0;
float3 normal: NORMAL0;
float3 tangent: TANGENT0;
float3 binormal: BINORMAL0;
};
struct VS_OUTPUT
{
float4 position: SV_POSITION;
float2 texcoord: TEXCOORD0;
float3 direction_to_camera: TEXCOORD1;
row_major float3x3 tbn:TEXCOORD2;
};
cbuffer constant: register(b0)
{
row_major float4x4 m_world;
row_major float4x4 m_view;
row_major float4x4 m_proj;
float4 m_light_direction;
float4 m_camera_position;
float4 m_light_position;
float m_light_radius;
float m_time;
};
VS_OUTPUT vsmain(VS_INPUT input)
{
VS_OUTPUT output = (VS_OUTPUT)0;
//output.position = lerp(input.position, input.position1, (sin(m_angle) + 1.0f) / 2.0f);
//WORLD SPACE
output.position = mul(input.position, m_world);
output.direction_to_camera = normalize(output.position.xyz - m_camera_position.xyz);
//VIEW SPACE
output.position = mul(output.position, m_view);
//SCREEN SPACE
output.position = mul(output.position, m_proj);
output.texcoord = input.texcoord;
output.tbn[0] = normalize(mul(input.tangent, m_world));
output.tbn[1] = normalize(mul(input.binormal, m_world));
output.tbn[2] = normalize(mul(input.normal, m_world));
return output;
}