mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 00:28:20 +00:00
[client] egl: make nightvision enhance luminosity before gain
This commit is contained in:
parent
d6805cfa0f
commit
1fbba5cf2d
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user