mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
GL3: gl3_intensity_2D cvar for HUD, menu, console, video intensity
there have been complaints that those things look too bright, so let people configure their intensity independently of the general intensity used for levels, monsters etc. fixes #189
This commit is contained in:
parent
ff6e7ede26
commit
79e9c8c3d0
3 changed files with 14 additions and 4 deletions
|
@ -104,6 +104,7 @@ cvar_t *gl_lefthand;
|
|||
cvar_t *gl_farsee;
|
||||
|
||||
cvar_t *gl3_intensity;
|
||||
cvar_t *gl3_intensity_2D;
|
||||
cvar_t *gl_lightlevel;
|
||||
cvar_t *gl3_overbrightbits;
|
||||
|
||||
|
@ -226,6 +227,7 @@ GL3_Register(void)
|
|||
vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
|
||||
vid_gamma = ri.Cvar_Get("vid_gamma", "1.2", CVAR_ARCHIVE);
|
||||
gl3_intensity = ri.Cvar_Get("gl3_intensity", "1.5", CVAR_ARCHIVE);
|
||||
gl3_intensity_2D = ri.Cvar_Get("gl3_intensity_2D", "1.5", CVAR_ARCHIVE);
|
||||
|
||||
gl_lightlevel = ri.Cvar_Get("gl_lightlevel", "0", 0);
|
||||
gl3_overbrightbits = ri.Cvar_Get("gl3_overbrightbits", "1.3", CVAR_ARCHIVE);
|
||||
|
@ -1619,13 +1621,15 @@ GL3_BeginFrame(float camera_separation)
|
|||
}
|
||||
#endif // 0
|
||||
|
||||
if (vid_gamma->modified || gl3_intensity->modified)
|
||||
if (vid_gamma->modified || gl3_intensity->modified || gl3_intensity_2D->modified)
|
||||
{
|
||||
vid_gamma->modified = false;
|
||||
gl3_intensity->modified = false;
|
||||
gl3_intensity_2D->modified = false;
|
||||
|
||||
gl3state.uniCommonData.gamma = 1.0f/vid_gamma->value;
|
||||
gl3state.uniCommonData.intensity = gl3_intensity->value;
|
||||
gl3state.uniCommonData.intensity2D = gl3_intensity_2D->value;
|
||||
GL3_UpdateUBOCommon();
|
||||
}
|
||||
|
||||
|
|
|
@ -192,6 +192,7 @@ static const char* fragmentSrc2D = MULTILINE_STRING(#version 150\n
|
|||
{
|
||||
float gamma;
|
||||
float intensity;
|
||||
float intensity2D; // for HUD, menu etc
|
||||
|
||||
vec4 color;
|
||||
};
|
||||
|
@ -210,7 +211,7 @@ static const char* fragmentSrc2D = MULTILINE_STRING(#version 150\n
|
|||
discard;
|
||||
|
||||
// apply gamma correction and intensity
|
||||
texel.rgb *= intensity;
|
||||
texel.rgb *= intensity2D;
|
||||
outColor.rgb = pow(texel.rgb, vec3(gamma));
|
||||
outColor.a = texel.a; // I think alpha shouldn't be modified by gamma and intensity
|
||||
}
|
||||
|
@ -240,6 +241,7 @@ static const char* fragmentSrc2Dcolor = MULTILINE_STRING(#version 150\n
|
|||
{
|
||||
float gamma;
|
||||
float intensity;
|
||||
float intensity2D; // for HUD, menus etc
|
||||
|
||||
vec4 color;
|
||||
};
|
||||
|
@ -248,7 +250,7 @@ static const char* fragmentSrc2Dcolor = MULTILINE_STRING(#version 150\n
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 col = color.rgb * intensity;
|
||||
vec3 col = color.rgb * intensity2D;
|
||||
outColor.rgb = pow(col, vec3(gamma));
|
||||
outColor.a = color.a;
|
||||
}
|
||||
|
@ -296,6 +298,7 @@ static const char* fragmentCommon3D = MULTILINE_STRING(#version 150\n
|
|||
{
|
||||
float gamma; // this is 1.0/vid_gamma
|
||||
float intensity;
|
||||
float intensity2D; // for HUD, menus etc
|
||||
|
||||
vec4 color; // really?
|
||||
|
||||
|
@ -934,6 +937,7 @@ static void initUBOs(void)
|
|||
{
|
||||
gl3state.uniCommonData.gamma = 1.0f/vid_gamma->value;
|
||||
gl3state.uniCommonData.intensity = gl3_intensity->value;
|
||||
gl3state.uniCommonData.intensity2D = gl3_intensity_2D->value;
|
||||
gl3state.uniCommonData.color = HMM_Vec4(1, 1, 1, 1);
|
||||
|
||||
glGenBuffers(1, &gl3state.uniCommonUBO);
|
||||
|
|
|
@ -123,10 +123,11 @@ typedef struct
|
|||
{
|
||||
GLfloat gamma;
|
||||
GLfloat intensity;
|
||||
GLfloat intensity2D; // for HUD, menus etc
|
||||
|
||||
// entries of std140 UBOs are aligned to multiples of their own size
|
||||
// so we'll need to pad accordingly for following vec4
|
||||
GLfloat _padding[2];
|
||||
GLfloat _padding;
|
||||
|
||||
hmm_vec4 color;
|
||||
} gl3UniCommon_t;
|
||||
|
@ -498,6 +499,7 @@ extern cvar_t *gl_drawworld;
|
|||
|
||||
extern cvar_t *vid_gamma;
|
||||
extern cvar_t *gl3_intensity;
|
||||
extern cvar_t *gl3_intensity_2D;
|
||||
extern cvar_t *gl_anisotropic;
|
||||
|
||||
extern cvar_t *gl_lightlevel;
|
||||
|
|
Loading…
Reference in a new issue