From f2266b843959413277767a990bb9a9c5593f3489 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sun, 13 Jun 2021 13:47:33 +0500 Subject: Implemented basic RmlUi integration --- cwd/assets/altcraft/shaders/vert/rml.vs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 cwd/assets/altcraft/shaders/vert/rml.vs (limited to 'cwd/assets/altcraft/shaders/vert/rml.vs') diff --git a/cwd/assets/altcraft/shaders/vert/rml.vs b/cwd/assets/altcraft/shaders/vert/rml.vs new file mode 100644 index 0000000..bfc50fb --- /dev/null +++ b/cwd/assets/altcraft/shaders/vert/rml.vs @@ -0,0 +1,21 @@ +#version 330 core + +uniform uvec2 viewportSize; +uniform mat4 rotationMat; + +layout (location = 0) in vec2 pos; +layout (location = 1) in uvec4 color; +layout (location = 2) in vec2 tex_coord; + +out VS_OUT { + vec4 color; + vec2 tex_coord; +} 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); + 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; +} -- cgit v1.2.3 From cc937302964a04aa8e7cdc0e6796503559efaa69 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sun, 13 Jun 2021 21:20:25 +0500 Subject: Improved RmlUi integration --- cwd/assets/altcraft/shaders/vert/rml.vs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cwd/assets/altcraft/shaders/vert/rml.vs') 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; } -- cgit v1.2.3