From ec4017bb0ff221c5c3e192a165c8d60a54f3bedc Mon Sep 17 00:00:00 2001 From: ccolin Date: Sun, 3 Jan 2021 17:10:26 +0100 Subject: highlight colliding drones --- shaders/main.frag | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'shaders/main.frag') diff --git a/shaders/main.frag b/shaders/main.frag index 7120521..f69789c 100644 --- a/shaders/main.frag +++ b/shaders/main.frag @@ -3,6 +3,7 @@ varying vec2 uv; varying vec3 frag_pos; uniform sampler2D tex; +uniform bool highlight; void main() { vec3 light_col = vec3(1, .964, .783); @@ -12,5 +13,10 @@ void main() { float diff = max(dot(normalize(norm), light_dir), 0.0); vec3 diffuse = diff * light_col; - gl_FragColor = texture2D(tex, uv) * vec4(ambient + diffuse, 1); + vec4 col = texture2D(tex, uv) * vec4(ambient + diffuse, 1); + + if (highlight) { + col = mix(col, vec4(1, 0, 0, 1), .5); + } + gl_FragColor = col; } -- cgit v1.2.3-70-g09d2