forked from vixorien/D3D11Starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Structs.hlsli
52 lines (48 loc) · 1.71 KB
/
Structs.hlsli
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
#ifndef __GGP_SHADER_STRUCTS__
#define __GGP_SHADER_STRUCTS__
// Struct representing a single vertex worth of data
// - This should match the vertex definition in our C++ code
// - By "match", I mean the size, order and number of members
// - The name of the struct itself is unimportant, but should be descriptive
// - Each variable must have a semantic, which defines its usage
struct VertexShaderInput
{
// Data type
// |
// | Name Semantic
// | | |
// v v v
float3 localPosition : POSITION; // XYZ position
float2 uv : TEXCOORD; // UV position
float3 normal : NORMAL; // Normal
float3 tangent : TANGENT; // Tangent
};
// Struct representing the data we're sending down the pipeline
// - Should match our pixel shader's input (hence the name: Vertex to Pixel)
// - At a minimum, we need a piece of data defined tagged as SV_POSITION
// - The name of the struct itself is unimportant, but should be descriptive
// - Each variable must have a semantic, which defines its usage
struct VertexToPixel
{
// Data type
// |
// | Name Semantic
// | | |
// v v v
float4 screenPosition : SV_POSITION; // XYZW position (System Value Position)
float2 uv : TEXCOORD; // UV position
float3 normal : NORMAL; // Pixel's surface normal's direction
float3 worldPosition : POSITION; // Pixel's world position
float3 tangent : TANGENT; // The tangent along the surface, oriented to the u of the uv
};
struct SkyVertexToPixel
{
// Data type
// |
// | Name Semantic
// | | |
// v v v
float4 screenPosition : SV_POSITION;
float3 sampleDir : DIRECTION;
};
#endif