[client] egl: make nightvision enhance luminosity before gain

This commit is contained in:
Geoffrey McRae 2019-03-31 00:08:52 +11:00
parent d6805cfa0f
commit 1fbba5cf2d
4 changed files with 14 additions and 3 deletions

View file

@ -1 +1 @@
a12-134-g4dee965fdf+1
a12-135-gd6805cfa0f+1

View file

@ -131,7 +131,9 @@ void egl_desktop_toggle_nv(SDL_Scancode key, void * opaque)
if (++desktop->nvGain == 4)
desktop->nvGain = 0;
app_alert(LG_ALERT_INFO, "Screen Gain +%d", desktop->nvGain);
if (desktop->nvGain == 0) app_alert(LG_ALERT_INFO, "NV Disabled");
else if (desktop->nvGain == 1) app_alert(LG_ALERT_INFO, "NV Enabled");
else app_alert(LG_ALERT_INFO, "NV Gain + %d", desktop->nvGain - 1);
}
void egl_desktop_free(EGL_Desktop ** desktop)
@ -240,7 +242,7 @@ void egl_desktop_render(EGL_Desktop * desktop, const float x, const float y, con
if (desktop->nvGain)
{
glUniform1i(desktop->uNV, 1);
glUniform1f(desktop->uNVGain, (float)(desktop->nvGain+1));
glUniform1f(desktop->uNVGain, (float)desktop->nvGain);
}
else
glUniform1i(desktop->uNV, 0);

View file

@ -10,6 +10,11 @@ uniform highp float nvGain;
void main()
{
color = texture(sampler1, uv);
if (nv == 1)
{
highp float lumi = 1.0 - (0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b);
color *= 1.0 + lumi;
color *= nvGain;
}
}

View file

@ -28,5 +28,9 @@ void main()
color = yuv * yuv_to_rgb;
if (nv == 1)
{
highp float lumi = 1.0 - (0.2126 * color.r + 0.7152 * color.g + 0.0722 * color.b);
color *= 1.0 + lumi;
color *= nvGain;
}
}