blob: 61b7032a2db7d31d7c6694438c0cd03620b232d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
shader_type spatial;
render_mode unshaded;
// Cosmetic terrain texture
uniform sampler2D terrain_tex: source_color, repeat_enable;
// Province shape texture
uniform sampler2D province_tex: source_color, repeat_enable;
// 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;
const vec3 NULL_COLOUR = vec3(0.0);
void fragment() {
vec3 terrain_colour = texture(terrain_tex, UV).rgb;
vec3 prov_colour = texture(province_tex, UV).rgb;
vec3 hover_colour = texture(province_tex, hover_pos).rgb;
vec3 selected_colour = texture(province_tex, selected_pos).rgb;
// Boost prov_colour's contribution if it matches hover_colour or selected_colour
float mix_val = float(prov_colour == hover_colour) * 0.3 + float(prov_colour == selected_colour) * 0.5;
// Set to 0 if the province has NULL colour
mix_val *= 1.0 - float(prov_colour == NULL_COLOUR);
ALBEDO = mix(terrain_colour, prov_colour, mix_val);
}
|