summaryrefslogtreecommitdiffstats
path: root/cwd
diff options
context:
space:
mode:
authorLaG1924 <lag1924@gmail.com>2021-06-13 10:47:33 +0200
committerLaG1924 <lag1924@gmail.com>2021-06-13 10:47:33 +0200
commitf2266b843959413277767a990bb9a9c5593f3489 (patch)
treef26e90e9f7ceb9be3c108eb5129305356ac8df3a /cwd
parentAdded RmlUi to CMakeLists.txt (diff)
downloadAltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.gz
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.bz2
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.lz
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.xz
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.tar.zst
AltCraft-f2266b843959413277767a990bb9a9c5593f3489.zip
Diffstat (limited to 'cwd')
-rw-r--r--cwd/assets/altcraft/shaders/frag/rml.fs12
-rw-r--r--cwd/assets/altcraft/shaders/frag/rmltex.fs14
-rw-r--r--cwd/assets/altcraft/shaders/rml.json7
-rw-r--r--cwd/assets/altcraft/shaders/rmltex.json8
-rw-r--r--cwd/assets/altcraft/shaders/vert/rml.vs21
-rw-r--r--cwd/test.rcss6
-rw-r--r--cwd/test.rml10
7 files changed, 78 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..c62ff25
--- /dev/null
+++ b/cwd/assets/altcraft/shaders/rml.json
@@ -0,0 +1,7 @@
+{
+ "vert": "/altcraft/shaders/vert/rml",
+ "frag": "/altcraft/shaders/frag/rml",
+ "uniforms": [
+ "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..3fef969
--- /dev/null
+++ b/cwd/assets/altcraft/shaders/rmltex.json
@@ -0,0 +1,8 @@
+{
+ "vert": "/altcraft/shaders/vert/rml",
+ "frag": "/altcraft/shaders/frag/rmltex",
+ "uniforms": [
+ "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..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;
+}
diff --git a/cwd/test.rcss b/cwd/test.rcss
new file mode 100644
index 0000000..47441bb
--- /dev/null
+++ b/cwd/test.rcss
@@ -0,0 +1,6 @@
+body {
+ background-color: red;
+ color: blue;
+ font-size: 100px;
+ font-family: "open sans";
+}
diff --git a/cwd/test.rml b/cwd/test.rml
new file mode 100644
index 0000000..ee72ece
--- /dev/null
+++ b/cwd/test.rml
@@ -0,0 +1,10 @@
+<rml>
+ <head>
+ <link type="text/rcss" href="test.rcss" />
+ </head>
+ <body>
+ <div style="background-color:green;">
+ Test RmlUi
+ </div>
+ </body>
+</rmL>