aboutsummaryrefslogtreecommitdiff
path: root/game/src/GameSession/Minimap.gdshader
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-04-30 21:09:35 +0200
committer Hop311 <hop3114@gmail.com>2023-04-30 21:09:35 +0200
commitbce925ad8efa7bbf508e79cab2110416a71cb8ee (patch)
treef8ede3f3734c5c34abddd783984cc6a4b97c5810 /game/src/GameSession/Minimap.gdshader
parent7e2700514652212e50a006ad525e7c7ca8e7840c (diff)
Highlight selected province on minimap
Diffstat (limited to 'game/src/GameSession/Minimap.gdshader')
-rw-r--r--game/src/GameSession/Minimap.gdshader13
1 files changed, 12 insertions, 1 deletions
diff --git a/game/src/GameSession/Minimap.gdshader b/game/src/GameSession/Minimap.gdshader
index 9afd470..8b68108 100644
--- a/game/src/GameSession/Minimap.gdshader
+++ b/game/src/GameSession/Minimap.gdshader
@@ -2,6 +2,17 @@ shader_type canvas_item;
#include "ProvinceIndexSampler.gdshaderinc"
+// Index of the currently selected province
+uniform uint selected_index;
+
+const vec3 land_colour = vec3(0.5);
+const vec3 selected_colour = vec3(1.0, 1.0, 0.0);
+
void fragment() {
- COLOR.rgb = mix(COLOR.rgb, vec3(0.5), float(read_uvec3(UV).b != 0u));
+ uvec3 data = read_uvec3(UV);
+ uint index = uvec2_to_uint(data.rg);
+ float is_land = float(data.b != 0u);
+ float is_selected = float(index == selected_index);
+ COLOR.rgb = mix(COLOR.rgb, land_colour, is_land);
+ COLOR.rgb = mix(COLOR.rgb, selected_colour, is_selected);
}