-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDS_Wave.hlsl
48 lines (37 loc) · 956 Bytes
/
DS_Wave.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
#include "VS_TransformConstBuffer.hlsli"
struct DS_OUTPUT
{
float4 position : SV_POSITION;
};
struct HS_CONTROL_POINT_OUTPUT
{
float4 position : SV_POSITION;
};
struct HS_CONSTANT_DATA_OUTPUT
{
float EdgeTessFactor[3] : SV_TessFactor;
float InsideTessFactor : SV_InsideTessFactor;
};
cbuffer timeData : register(b1)
{
float time;
}
cbuffer waveData : register(b2)
{
float stepness;
float speed;
float scale;
};
#define NUM_CONTROL_POINTS 3
[domain("tri")]
DS_OUTPUT main(
HS_CONSTANT_DATA_OUTPUT input,
float3 domain : SV_DomainLocation,
const OutputPatch<HS_CONTROL_POINT_OUTPUT, NUM_CONTROL_POINTS> patch)
{
DS_OUTPUT Output;
Output.position = patch[0].position * domain.x + patch[1].position * domain.y + patch[2].position * domain.z;
Output.position.y = (sin(Output.position.x * stepness + time * speed) - 0.5f) * scale + Output.position.y;
Output.position = mul(Output.position, modelViewProjection);
return Output;
}