summaryrefslogtreecommitdiffstats
path: root/cwd/assets/altcraft/shaders/vert
diff options
context:
space:
mode:
Diffstat (limited to 'cwd/assets/altcraft/shaders/vert')
-rw-r--r--cwd/assets/altcraft/shaders/vert/entity.vs17
-rw-r--r--cwd/assets/altcraft/shaders/vert/face.vs49
-rw-r--r--cwd/assets/altcraft/shaders/vert/fbo.vs11
-rw-r--r--cwd/assets/altcraft/shaders/vert/quad.vs23
-rw-r--r--cwd/assets/altcraft/shaders/vert/rml.vs32
-rw-r--r--cwd/assets/altcraft/shaders/vert/sky.vs21
6 files changed, 103 insertions, 50 deletions
diff --git a/cwd/assets/altcraft/shaders/vert/entity.vs b/cwd/assets/altcraft/shaders/vert/entity.vs
index e38c54c..8cc7f69 100644
--- a/cwd/assets/altcraft/shaders/vert/entity.vs
+++ b/cwd/assets/altcraft/shaders/vert/entity.vs
@@ -1,10 +1,21 @@
#version 330 core
-in vec3 position;
+in vec3 pos;
-uniform mat4 projView;
uniform mat4 model;
+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 * model * vec4(position, 1);
+ gl_Position = projView * model * vec4(pos, 1);
}
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;
}
diff --git a/cwd/assets/altcraft/shaders/vert/fbo.vs b/cwd/assets/altcraft/shaders/vert/fbo.vs
deleted file mode 100644
index e1e8966..0000000
--- a/cwd/assets/altcraft/shaders/vert/fbo.vs
+++ /dev/null
@@ -1,11 +0,0 @@
-#version 330 core
-layout (location = 0) in vec2 Pos;
-layout (location = 1) in vec2 TextureCoords;
-
-out vec2 TexCoords;
-
-void main()
-{
- gl_Position = vec4(Pos.x, Pos.y, 0.0, 1.0);
- TexCoords = TextureCoords;
-} \ No newline at end of file
diff --git a/cwd/assets/altcraft/shaders/vert/quad.vs b/cwd/assets/altcraft/shaders/vert/quad.vs
new file mode 100644
index 0000000..9add76d
--- /dev/null
+++ b/cwd/assets/altcraft/shaders/vert/quad.vs
@@ -0,0 +1,23 @@
+#version 330 core
+
+in vec2 pos;
+in vec2 uvPos;
+
+out vec2 uv;
+
+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 = vec4(pos.x, pos.y, 0.0, 1.0);
+ uv = uvPos;
+}
diff --git a/cwd/assets/altcraft/shaders/vert/rml.vs b/cwd/assets/altcraft/shaders/vert/rml.vs
index bdd3b71..897f49d 100644
--- a/cwd/assets/altcraft/shaders/vert/rml.vs
+++ b/cwd/assets/altcraft/shaders/vert/rml.vs
@@ -1,22 +1,30 @@
#version 330 core
-uniform uvec2 viewportSize;
-uniform vec2 translation;
-uniform mat4 rotationMat;
+in vec2 pos;
+in uvec4 col;
+in vec2 uvPos;
+
+out vec4 color;
+out vec2 uv;
-layout (location = 0) in vec2 pos;
-layout (location = 1) in uvec4 color;
-layout (location = 2) in vec2 tex_coord;
+uniform vec2 translation;
-out VS_OUT {
- vec4 color;
- vec2 tex_coord;
-} vs_out;
+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() {
float x = ((pos.x + translation.x) / viewportSize.x) * 2.0f - 1.0f;
float y = ((pos.y + translation.y) / viewportSize.y) * 2.0f - 1.0f;
gl_Position = vec4(x, -y, -1.0f, 1.0f);
- vs_out.color = vec4(float(color.x) / 255.0f, float(color.y) / 255.0f, float(color.z) / 255.0f, float(color.w) / 255.0f);
- vs_out.tex_coord = tex_coord;
+ color = vec4(float(col.x) / 255.0f, float(col.y) / 255.0f, float(col.z) / 255.0f, float(col.w) / 255.0f);
+ uv = uvPos;
}
diff --git a/cwd/assets/altcraft/shaders/vert/sky.vs b/cwd/assets/altcraft/shaders/vert/sky.vs
index 0ab261c..c618852 100644
--- a/cwd/assets/altcraft/shaders/vert/sky.vs
+++ b/cwd/assets/altcraft/shaders/vert/sky.vs
@@ -1,13 +1,24 @@
#version 330 core
-in vec3 position;
+in vec3 pos;
-out vec3 pos;
+out vec3 facePos;
-uniform mat4 projView;
uniform mat4 model;
+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() {
- pos = position;
- gl_Position = projView * model * vec4(position, 1);
+ facePos = pos;
+ gl_Position = projView * model * vec4(pos, 1);
}