summaryrefslogtreecommitdiffstats
path: root/cwd/assets/altcraft/shaders
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-06-13 18:20:25 +0200
committerLaG1924 <lag1924@gmail.com>2021-06-13 18:20:25 +0200
commitcc937302964a04aa8e7cdc0e6796503559efaa69 (patch)
tree3a6b890d32ed735d42f042a08c1af9637cb62b70 /cwd/assets/altcraft/shaders
parentFixed Linux build of RmlUi (diff)
downloadAltCraft-cc937302964a04aa8e7cdc0e6796503559efaa69.tar
AltCraft-cc937302964a04aa8e7cdc0e6796503559efaa69.tar.gz
AltCraft-cc937302964a04aa8e7cdc0e6796503559efaa69.tar.bz2
AltCraft-cc937302964a04aa8e7cdc0e6796503559efaa69.tar.lz
AltCraft-cc937302964a04aa8e7cdc0e6796503559efaa69.tar.xz
AltCraft-cc937302964a04aa8e7cdc0e6796503559efaa69.tar.zst
AltCraft-cc937302964a04aa8e7cdc0e6796503559efaa69.zip
Diffstat (limited to 'cwd/assets/altcraft/shaders')
-rw-r--r--cwd/assets/altcraft/shaders/rml.json1
-rw-r--r--cwd/assets/altcraft/shaders/rmltex.json1
-rw-r--r--cwd/assets/altcraft/shaders/vert/rml.vs7
3 files changed, 6 insertions, 3 deletions
diff --git a/cwd/assets/altcraft/shaders/rml.json b/cwd/assets/altcraft/shaders/rml.json
index c62ff25..0cd85cc 100644
--- a/cwd/assets/altcraft/shaders/rml.json
+++ b/cwd/assets/altcraft/shaders/rml.json
@@ -2,6 +2,7 @@
"vert": "/altcraft/shaders/vert/rml",
"frag": "/altcraft/shaders/frag/rml",
"uniforms": [
+ "translation",
"viewportSize"
]
} \ No newline at end of file
diff --git a/cwd/assets/altcraft/shaders/rmltex.json b/cwd/assets/altcraft/shaders/rmltex.json
index 3fef969..a8a1323 100644
--- a/cwd/assets/altcraft/shaders/rmltex.json
+++ b/cwd/assets/altcraft/shaders/rmltex.json
@@ -2,6 +2,7 @@
"vert": "/altcraft/shaders/vert/rml",
"frag": "/altcraft/shaders/frag/rmltex",
"uniforms": [
+ "translation",
"viewportSize",
"fontTexture"
]
diff --git a/cwd/assets/altcraft/shaders/vert/rml.vs b/cwd/assets/altcraft/shaders/vert/rml.vs
index bfc50fb..bdd3b71 100644
--- a/cwd/assets/altcraft/shaders/vert/rml.vs
+++ b/cwd/assets/altcraft/shaders/vert/rml.vs
@@ -1,6 +1,7 @@
#version 330 core
uniform uvec2 viewportSize;
+uniform vec2 translation;
uniform mat4 rotationMat;
layout (location = 0) in vec2 pos;
@@ -13,9 +14,9 @@ out VS_OUT {
} vs_out;
void main() {
- float x = (pos.x - viewportSize.x) / viewportSize.x;
- float y = ((pos.y - viewportSize.y) / viewportSize.y) * -1;
- gl_Position = vec4(x, y, -1.0f, 1.0f);
+ 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;
}