summaryrefslogtreecommitdiffstats
path: root/cwd/assets/altcraft/shaders/vert/face.vs
diff options
context:
space:
mode:
Diffstat (limited to 'cwd/assets/altcraft/shaders/vert/face.vs')
-rw-r--r--cwd/assets/altcraft/shaders/vert/face.vs49
1 files changed, 30 insertions, 19 deletions
diff --git a/cwd/assets/altcraft/shaders/vert/face.vs b/cwd/assets/altcraft/shaders/vert/face.vs
index 93e623d..101e4d0 100644
--- a/cwd/assets/altcraft/shaders/vert/face.vs
+++ b/cwd/assets/altcraft/shaders/vert/face.vs
@@ -1,27 +1,38 @@
#version 330 core
-layout (location = 0) in vec3 position[4];
-layout (location = 4) in vec2 uv[4];
-layout (location = 8) in float uvLayer;
-layout (location = 9) in float animation;
-layout (location = 10) in vec3 color;
-layout (location = 11) in vec2 light;
+in vec3 pos[4];
+in vec2 uv[4];
+in vec2 light[4];
+in vec3 normal;
+in vec3 color;
+in vec3 layerAnimationAo;
-out VS_OUT {
- vec3 Texture;
- vec3 Color;
-} vs_out;
+out vec3 faceTextureUv;
+out vec3 faceNormal;
+out vec3 faceAddColor;
+out vec2 faceLight;
+out float faceAmbientOcclusion;
-uniform float GlobalTime;
-uniform mat4 projView;
-uniform float DayTime;
-uniform float MinLightLevel;
+layout (std140) uniform Globals {
+ mat4 projView;
+ mat4 proj;
+ mat4 invProj;
+ mat4 view;
+ uvec2 viewportSize;
+ vec4 ssaoKernels[64];
+ float globalTime;
+ float dayTime;
+ float gamma;
+};
void main() {
- gl_Position = projView * vec4(position[gl_VertexID], 1.0f);
- vs_out.Texture = vec3(uv[gl_VertexID], uvLayer);
- vs_out.Texture.y -= (uv[2].y - uv[0].y) * trunc(mod(GlobalTime * 4.0f, animation));
+ gl_Position = projView * vec4(pos[gl_VertexID], 1.0f);
- float faceLight = clamp(light.x / 15.0 + (light.y / 15.0) * DayTime, MinLightLevel, 1.0);
- vs_out.Color = mix(color.rgb * faceLight, vec3(1,1,1) * faceLight, float(color == vec3(0,0,0)));
+ faceTextureUv = vec3(uv[gl_VertexID], layerAnimationAo.r);
+ faceTextureUv.y -= (uv[2].y - uv[0].y) * trunc(mod(globalTime * 4.0f, layerAnimationAo.g));
+
+ faceNormal = (view * vec4(normal, 0.0f)).xyz;
+ faceAddColor = color;
+ faceLight = light[gl_VertexID];
+ faceAmbientOcclusion = layerAnimationAo.b;
}