diff options
author | ccolin | 2021-01-03 17:10:26 +0100 |
---|---|---|
committer | ccolin | 2021-01-03 17:10:26 +0100 |
commit | ec4017bb0ff221c5c3e192a165c8d60a54f3bedc (patch) | |
tree | f2aff28ed1d244fd53ef73543f6d1408653ca5fa /shaders/main.frag | |
parent | 14b5993f0f4bb4fc2d33394780e6d8911c8783d7 (diff) |
highlight colliding drones
Diffstat (limited to 'shaders/main.frag')
-rw-r--r-- | shaders/main.frag | 8 |
1 files changed, 7 insertions, 1 deletions
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; } |