diff options
| author | Matt Kosarek <matt.kosarek@canonical.com> | 2026-02-19 16:58:58 -0500 |
|---|---|---|
| committer | Matt Kosarek <matt.kosarek@canonical.com> | 2026-02-19 16:58:58 -0500 |
| commit | da0eedbf1733e40613215ecd117e1a4e049089ad (patch) | |
| tree | d83d5dc63b50efbd45084d692ae037cbe0f02b25 /themes/src/_shaders | |
| parent | 4d1beea73810af4641d074f974ad9c196a7e8d6e (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 | 11 | ||||
| -rw-r--r-- | themes/src/_shaders/grass.vert | 25 |
2 files changed, 36 insertions, 0 deletions
diff --git a/themes/src/_shaders/grass.frag b/themes/src/_shaders/grass.frag new file mode 100644 index 0000000..a72f078 --- /dev/null +++ b/themes/src/_shaders/grass.frag @@ -0,0 +1,11 @@ +varying lowp vec2 vUV; + +void main() { + lowp float halfWidth = 0.5 * (1.0 - vUV.y); + lowp float distFromCenter = abs(vUV.x - 0.5); + if (distFromCenter > halfWidth) discard; + + lowp vec3 baseColor = vec3(0.15, 0.45, 0.10); + lowp vec3 tipColor = vec3(0.40, 0.75, 0.20); + gl_FragColor = vec4(mix(baseColor, tipColor, vUV.y), 1.0); +} diff --git a/themes/src/_shaders/grass.vert b/themes/src/_shaders/grass.vert new file mode 100644 index 0000000..0cf0285 --- /dev/null +++ b/themes/src/_shaders/grass.vert @@ -0,0 +1,25 @@ +attribute vec2 position; // Local quad vertex: x in [-0.5, 0.5], y in [0, 1] +attribute vec3 instancePos; // Per-instance: world-space base of blade +attribute float instancePhase; // Per-instance: random phase offset for sway +attribute float instanceHeight; // Per-instance: height scale multiplier + +uniform mat4 projection; +uniform mat4 view; +uniform float time; +uniform float bladeWidth; +uniform float bladeHeight; +uniform float swayAmount; + +varying lowp vec2 vUV; + +void main() { + vec3 cameraRight = vec3(view[0][0], view[1][0], view[2][0]); + float h = bladeHeight * instanceHeight; + float sway = sin(time * 1.5 + instancePhase) * swayAmount * position.y; + vec3 worldPos = instancePos + + cameraRight * (position.x + sway) * bladeWidth + + vec3(0.0, 1.0, 0.0) * position.y * h; + + gl_Position = projection * view * vec4(worldPos, 1.0); + vUV = vec2(position.x + 0.5, position.y); +} |
