summaryrefslogtreecommitdiffstats
path: root/cwd/assets/altcraft/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'cwd/assets/altcraft/shaders')
-rw-r--r--cwd/assets/altcraft/shaders/frag/face.fs3
-rw-r--r--cwd/assets/altcraft/shaders/vert/face.vs37
2 files changed, 10 insertions, 30 deletions
diff --git a/cwd/assets/altcraft/shaders/frag/face.fs b/cwd/assets/altcraft/shaders/frag/face.fs
index bd2a2d7..314e47b 100644
--- a/cwd/assets/altcraft/shaders/frag/face.fs
+++ b/cwd/assets/altcraft/shaders/frag/face.fs
@@ -1,7 +1,6 @@
#version 330 core
in VS_OUT {
- vec2 UvPosition;
vec3 Texture;
vec3 Color;
vec2 Light;
@@ -47,4 +46,4 @@ void main() {
color = vec4(color.rgb * faceLight, color.a);
fragColor = color;
-} \ No newline at end of file
+}
diff --git a/cwd/assets/altcraft/shaders/vert/face.vs b/cwd/assets/altcraft/shaders/vert/face.vs
index e054dd8..e1f01fc 100644
--- a/cwd/assets/altcraft/shaders/vert/face.vs
+++ b/cwd/assets/altcraft/shaders/vert/face.vs
@@ -1,15 +1,13 @@
#version 330 core
-layout (location = 3) in vec4 position[4];
-layout (location = 2) in vec2 UvCoordinates;
-layout (location = 11) in vec4 Texture;
-layout (location = 12) in vec3 color;
-layout (location = 13) in vec2 light;
-layout (location = 14) in float TextureLayer;
-layout (location = 15) in float TextureFrames;
+layout (location = 0) in vec4 position[4];
+layout (location = 4) in vec2 uv[4];
+layout (location = 8) in float uvLayer;
+layout (location = 9) in vec2 animation;
+layout (location = 10) in vec3 color;
+layout (location = 11) in vec2 light;
out VS_OUT {
- vec2 UvPosition;
vec3 Texture;
vec3 Color;
vec2 Light;
@@ -18,27 +16,10 @@ out VS_OUT {
uniform float GlobalTime;
uniform mat4 projView;
-vec3 TransformTextureCoord(vec4 TextureAtlasCoords, vec2 UvCoords, float Layer) {
- float x = TextureAtlasCoords.x;
- float y = TextureAtlasCoords.y;
- float h = TextureAtlasCoords.w;
- vec2 transformed = vec2(x, 1 - y - h) + UvCoords * TextureAtlasCoords.zw;
- return vec3(transformed.x, transformed.y, Layer);
-}
-
-void main()
-{
+void main() {
gl_Position = projView * position[gl_VertexID];
-
- vec4 texturePos = Texture;
- float frameHeight = texturePos.w / TextureFrames;
- float currentFrame = mod(GlobalTime * 4.0f, TextureFrames);
- currentFrame = trunc(currentFrame);
- texturePos.w = frameHeight;
- texturePos.y = texturePos.y + currentFrame * frameHeight;
-
- vs_out.UvPosition = UvCoordinates;
- vs_out.Texture = TransformTextureCoord(texturePos,UvCoordinates,TextureLayer);
vs_out.Color = color;
vs_out.Light = light;
+ vs_out.Texture = vec3(uv[gl_VertexID], uvLayer);
+ vs_out.Texture.y -= animation.x * trunc(mod(GlobalTime * 4.0f, animation.y));
}