]> git.lizzy.rs Git - dragonblocks_alpha.git/blobdiff - shaders/3d/vertex.glsl
Add fog and face culling
[dragonblocks_alpha.git] / shaders / 3d / vertex.glsl
index 91948c0fb12015efb324cdeab5d6da45cc0b2a4a..bb991ae628cccdbd53c344d5a08f5228043cfade 100755 (executable)
@@ -1,22 +1,26 @@
-#version 460 core
-
 layout(location = 0) in vec3 vertexPosition;
-layout(location = 1) in float vertexTextureIndex;
-layout(location = 2) in vec2 vertexTextureCoords;
-layout(location = 3) in vec3 vertexColor;
+layout(location = 1) in vec3 vertexNormal;
+layout(location = 2) in float vertexTextureIndex;
+layout(location = 3) in vec2 vertexTextureCoords;
+layout(location = 4) in vec3 vertexColor;
 
+out vec3 fragmentPosition;
+out vec3 fragmentNormal;
 out float fragmentTextureIndex;
 out vec2 fragmentTextureCoords;
 out vec3 fragmentColor;
 
-uniform mat4 MVP;
+uniform mat4 model;
+uniform mat4 VP;
 
 void main()
 {
-    gl_Position = MVP * vec4(vertexPosition, 1.0);
+       vec4 worldSpace = model * vec4(vertexPosition, 1.0);
+       gl_Position = VP * worldSpace;
 
-    fragmentTextureIndex = vertexTextureIndex;
-    fragmentTextureCoords = vertexTextureCoords;
+       fragmentPosition = worldSpace.xyz;
+       fragmentNormal = vertexNormal;
+       fragmentTextureIndex = vertexTextureIndex;
+       fragmentTextureCoords = vertexTextureCoords;
        fragmentColor = vertexColor;
 }
-