summaryrefslogtreecommitdiff
path: root/themes/src/shaders
diff options
context:
space:
mode:
authorMatt Kosarek <matt.kosarek@canonical.com>2026-02-19 16:58:58 -0500
committerMatt Kosarek <matt.kosarek@canonical.com>2026-02-19 16:58:58 -0500
commitda0eedbf1733e40613215ecd117e1a4e049089ad (patch)
treed83d5dc63b50efbd45084d692ae037cbe0f02b25 /themes/src/shaders
parent4d1beea73810af4641d074f974ad9c196a7e8d6e (diff)
Removed photo gallery + added cute little grass rendering for the rabbit and a nice gradient backgroundHEADmaster
Diffstat (limited to 'themes/src/shaders')
-rw-r--r--themes/src/shaders/grass_frag.cpp14
-rw-r--r--themes/src/shaders/grass_frag.h4
-rw-r--r--themes/src/shaders/grass_vert.cpp28
-rw-r--r--themes/src/shaders/grass_vert.h4
4 files changed, 50 insertions, 0 deletions
diff --git a/themes/src/shaders/grass_frag.cpp b/themes/src/shaders/grass_frag.cpp
new file mode 100644
index 0000000..5a62cf2
--- /dev/null
+++ b/themes/src/shaders/grass_frag.cpp
@@ -0,0 +1,14 @@
+#include "grass_frag.h"
+
+const char* shader_grass_frag = "varying lowp vec2 vUV; \n"
+" \n"
+"void main() { \n"
+" lowp float halfWidth = 0.5 * (1.0 - vUV.y); \n"
+" lowp float distFromCenter = abs(vUV.x - 0.5); \n"
+" if (distFromCenter > halfWidth) discard; \n"
+" \n"
+" lowp vec3 baseColor = vec3(0.15, 0.45, 0.10); \n"
+" lowp vec3 tipColor = vec3(0.40, 0.75, 0.20); \n"
+" gl_FragColor = vec4(mix(baseColor, tipColor, vUV.y), 1.0); \n"
+"} \n"
+" \n";
diff --git a/themes/src/shaders/grass_frag.h b/themes/src/shaders/grass_frag.h
new file mode 100644
index 0000000..16cc29a
--- /dev/null
+++ b/themes/src/shaders/grass_frag.h
@@ -0,0 +1,4 @@
+#ifndef SHADER_GRASS_FRAG
+#define SHADER_GRASS_FRAG
+extern const char* shader_grass_frag;
+#endif
diff --git a/themes/src/shaders/grass_vert.cpp b/themes/src/shaders/grass_vert.cpp
new file mode 100644
index 0000000..c9d2955
--- /dev/null
+++ b/themes/src/shaders/grass_vert.cpp
@@ -0,0 +1,28 @@
+#include "grass_vert.h"
+
+const char* shader_grass_vert = "attribute vec2 position; // Local quad vertex: x in [-0.5, 0.5], y in [0, 1] \n"
+"attribute vec3 instancePos; // Per-instance: world-space base of blade \n"
+"attribute float instancePhase; // Per-instance: random phase offset for sway \n"
+"attribute float instanceHeight; // Per-instance: height scale multiplier \n"
+" \n"
+"uniform mat4 projection; \n"
+"uniform mat4 view; \n"
+"uniform float time; \n"
+"uniform float bladeWidth; \n"
+"uniform float bladeHeight; \n"
+"uniform float swayAmount; \n"
+" \n"
+"varying lowp vec2 vUV; \n"
+" \n"
+"void main() { \n"
+" vec3 cameraRight = vec3(view[0][0], view[1][0], view[2][0]); \n"
+" float h = bladeHeight * instanceHeight; \n"
+" float sway = sin(time * 1.5 + instancePhase) * swayAmount * position.y; \n"
+" vec3 worldPos = instancePos \n"
+" + cameraRight * (position.x + sway) * bladeWidth \n"
+" + vec3(0.0, 1.0, 0.0) * position.y * h; \n"
+" \n"
+" gl_Position = projection * view * vec4(worldPos, 1.0); \n"
+" vUV = vec2(position.x + 0.5, position.y); \n"
+"} \n"
+" \n";
diff --git a/themes/src/shaders/grass_vert.h b/themes/src/shaders/grass_vert.h
new file mode 100644
index 0000000..7ab52b6
--- /dev/null
+++ b/themes/src/shaders/grass_vert.h
@@ -0,0 +1,4 @@
+#ifndef SHADER_GRASS_VERT
+#define SHADER_GRASS_VERT
+extern const char* shader_grass_vert;
+#endif