]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - shaders/3d/vertex.glsl
Add fog and face culling
[dragonblocks_alpha.git] / shaders / 3d / vertex.glsl
1 layout(location = 0) in vec3 vertexPosition;
2 layout(location = 1) in vec3 vertexNormal;
3 layout(location = 2) in float vertexTextureIndex;
4 layout(location = 3) in vec2 vertexTextureCoords;
5 layout(location = 4) in vec3 vertexColor;
6
7 out vec3 fragmentPosition;
8 out vec3 fragmentNormal;
9 out float fragmentTextureIndex;
10 out vec2 fragmentTextureCoords;
11 out vec3 fragmentColor;
12
13 uniform mat4 model;
14 uniform mat4 VP;
15
16 void main()
17 {
18         vec4 worldSpace = model * vec4(vertexPosition, 1.0);
19         gl_Position = VP * worldSpace;
20
21         fragmentPosition = worldSpace.xyz;
22         fragmentNormal = vertexNormal;
23         fragmentTextureIndex = vertexTextureIndex;
24         fragmentTextureCoords = vertexTextureCoords;
25         fragmentColor = vertexColor;
26 }