diff options
author | Hop311 <hop3114@gmail.com> | 2023-04-11 00:27:08 +0200 |
---|---|---|
committer | Hop311 <hop3114@gmail.com> | 2023-04-11 00:27:08 +0200 |
commit | 5f09e4720581994ca88446add32d8b6189428b13 (patch) | |
tree | c70d279cef78eeac43f8ce5dd538254df1091cda /game/src/GameSession/TerrainMap.gdshader | |
parent | f1995b5ab16366eb0c005c0cafdfd797b6cfd1d2 (diff) |
Minimap viewport loops from x=0 to x=1
Diffstat (limited to 'game/src/GameSession/TerrainMap.gdshader')
-rw-r--r-- | game/src/GameSession/TerrainMap.gdshader | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/game/src/GameSession/TerrainMap.gdshader b/game/src/GameSession/TerrainMap.gdshader index f3d0c7d..7aca0f9 100644 --- a/game/src/GameSession/TerrainMap.gdshader +++ b/game/src/GameSession/TerrainMap.gdshader @@ -8,10 +8,10 @@ uniform sampler2D terrain_tex: source_color, repeat_enable, filter_linear; uniform sampler2D province_index_tex : repeat_enable, filter_nearest; // Province colour texture uniform sampler2D province_colour_tex: source_color, repeat_enable, filter_nearest; -// Position of the mouse over the map mesh in UV coords -uniform vec2 hover_pos; -// Position in UV coords of a pixel belonging to the currently selected province -uniform vec2 selected_pos; +// Index of the mouse over the map mesh +uniform uint hover_index; +// Index of the currently selected province +uniform uint selected_index; uvec2 vec2_to_uvec2(vec2 v) { return uvec2(v * 255.0); @@ -31,10 +31,7 @@ uint read_uint16(sampler2D tex, vec2 uv) { void fragment() { uvec2 prov_idx_split = read_uvec2(province_index_tex, UV); - uint prov_index = uvec2_to_uint(prov_idx_split); - uint hover_index = read_uint16(province_index_tex, hover_pos); - uint selected_index = read_uint16(province_index_tex, selected_pos); // Boost prov_colour's contribution if it matches hover_colour or selected_colour float mix_val = 0.3 + float(prov_index == hover_index) * 0.3 + float(prov_index == selected_index) * 0.3; |