diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2021-06-22 02:47:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-22 02:47:45 +0200 |
commit | e93df8332d86b67dff89d24788525a027b8d0c4c (patch) | |
tree | 3c2e085706f3824aa34d2dce5747c9c86a79723a /cwd/assets/altcraft/shaders | |
parent | Merge pull request #56 from LaG1924/ftr/upgrade-build-system (diff) | |
parent | Minor changes to Ui scripts (diff) | |
download | AltCraft-e93df8332d86b67dff89d24788525a027b8d0c4c.tar AltCraft-e93df8332d86b67dff89d24788525a027b8d0c4c.tar.gz AltCraft-e93df8332d86b67dff89d24788525a027b8d0c4c.tar.bz2 AltCraft-e93df8332d86b67dff89d24788525a027b8d0c4c.tar.lz AltCraft-e93df8332d86b67dff89d24788525a027b8d0c4c.tar.xz AltCraft-e93df8332d86b67dff89d24788525a027b8d0c4c.tar.zst AltCraft-e93df8332d86b67dff89d24788525a027b8d0c4c.zip |
Diffstat (limited to 'cwd/assets/altcraft/shaders')
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/rml.fs | 12 | ||||
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/rmltex.fs | 14 | ||||
-rw-r--r-- | cwd/assets/altcraft/shaders/rml.json | 8 | ||||
-rw-r--r-- | cwd/assets/altcraft/shaders/rmltex.json | 9 | ||||
-rw-r--r-- | cwd/assets/altcraft/shaders/vert/rml.vs | 22 |
5 files changed, 65 insertions, 0 deletions
diff --git a/cwd/assets/altcraft/shaders/frag/rml.fs b/cwd/assets/altcraft/shaders/frag/rml.fs new file mode 100644 index 0000000..54c3f36 --- /dev/null +++ b/cwd/assets/altcraft/shaders/frag/rml.fs @@ -0,0 +1,12 @@ +#version 330 core + +in VS_OUT { + vec4 color; + vec2 tex_coord; +} fs_in; + +out vec4 fragColor; + +void main() { + fragColor = fs_in.color; +} diff --git a/cwd/assets/altcraft/shaders/frag/rmltex.fs b/cwd/assets/altcraft/shaders/frag/rmltex.fs new file mode 100644 index 0000000..d885b3b --- /dev/null +++ b/cwd/assets/altcraft/shaders/frag/rmltex.fs @@ -0,0 +1,14 @@ +#version 330 core + +uniform sampler2D fontTexture; + +in VS_OUT { + vec4 color; + vec2 tex_coord; +} fs_in; + +out vec4 fragColor; + +void main() { + fragColor = fs_in.color * texture(fontTexture, fs_in.tex_coord); +} diff --git a/cwd/assets/altcraft/shaders/rml.json b/cwd/assets/altcraft/shaders/rml.json new file mode 100644 index 0000000..0cd85cc --- /dev/null +++ b/cwd/assets/altcraft/shaders/rml.json @@ -0,0 +1,8 @@ +{ + "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 new file mode 100644 index 0000000..a8a1323 --- /dev/null +++ b/cwd/assets/altcraft/shaders/rmltex.json @@ -0,0 +1,9 @@ +{ + "vert": "/altcraft/shaders/vert/rml", + "frag": "/altcraft/shaders/frag/rmltex", + "uniforms": [ + "translation", + "viewportSize", + "fontTexture" + ] +}
\ No newline at end of file diff --git a/cwd/assets/altcraft/shaders/vert/rml.vs b/cwd/assets/altcraft/shaders/vert/rml.vs new file mode 100644 index 0000000..bdd3b71 --- /dev/null +++ b/cwd/assets/altcraft/shaders/vert/rml.vs @@ -0,0 +1,22 @@ +#version 330 core + +uniform uvec2 viewportSize; +uniform vec2 translation; +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 + 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; +} |