diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 68e7bbcd..5dc52128 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -3177,14 +3177,15 @@ NOTE: dlights are ignored */ void TriLightAtPoint( float *pos, float *value ) { - color24 ambient; + colorVec vLightColor; if( !pos || !value ) return; - R_LightForPoint( pos, &ambient, false, false, 0.0f ); - value[0] = ambient.r; - value[1] = ambient.g; - value[2] = ambient.b; + vLightColor = R_LightPoint( pos ); + + value[0] = vLightColor.r; + value[1] = vLightColor.g; + value[2] = vLightColor.b; } /* diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index f6841257..7880237e 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -2654,7 +2654,7 @@ void CL_UpdateFlashlight( cl_entity_t *ent ) trace = CL_VisTraceLine( vecSrc, vecEnd, PM_STUDIO_BOX ); // update flashlight endpos - dl = CL_AllocDlight( ent->index ); + dl = CL_AllocElight( ent->index ); #if 0 // g-cont. disabled until studio lighting will be finished if( trace.ent > 0 && clgame.pmove->visents[trace.ent].studiomodel ) @@ -2796,11 +2796,14 @@ void CL_TestLights( void ) { int i, j; float f, r; + int numLights; dlight_t *dl; if( !cl_testlights->value ) return; + + numLights = bound( 1, cl_testlights->value, MAX_DLIGHTS ); - for( i = 0; i < bound( 1, cl_testlights->value, MAX_DLIGHTS ); i++ ) + for( i = 0; i < numLights; i++ ) { dl = &cl_dlights[i]; @@ -2813,8 +2816,8 @@ void CL_TestLights( void ) dl->color.r = ((((i % 6) + 1) & 1)>>0) * 255; dl->color.g = ((((i % 6) + 1) & 2)>>1) * 255; dl->color.b = ((((i % 6) + 1) & 4)>>2) * 255; + dl->radius = Q_max( 64, 200 - 5 * numLights ); dl->die = cl.time + host.frametime; - dl->radius = 200; } } diff --git a/engine/client/gl_backend.c b/engine/client/gl_backend.c index 12a5b72e..d4f5eac6 100644 --- a/engine/client/gl_backend.c +++ b/engine/client/gl_backend.c @@ -559,7 +559,7 @@ qboolean VID_ScreenShot( const char *filename, int shot_type ) break; } - Image_Process( &r_shot, width, height, 0.0f, flags, NULL ); + Image_Process( &r_shot, width, height, flags, NULL ); // write image result = FS_SaveImage( filename, r_shot ); @@ -628,7 +628,7 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo r_side->size = r_side->width * r_side->height * 3; r_side->buffer = temp; - if( flags ) Image_Process( &r_side, 0, 0, 0.0f, flags, NULL ); + if( flags ) Image_Process( &r_side, 0, 0, flags, NULL ); memcpy( buffer + (size * size * 3 * i), r_side->buffer, size * size * 3 ); } diff --git a/engine/client/gl_image.c b/engine/client/gl_image.c index 550bbd87..4a0a5c54 100644 --- a/engine/client/gl_image.c +++ b/engine/client/gl_image.c @@ -1213,7 +1213,7 @@ static void GL_ProcessImage( gltexture_t *tex, rgbdata_t *pic, imgfilter_t *filt img_flags |= IMAGE_FORCE_RGBA; // processing image before uploading (force to rgba, make luma etc) - if( pic->buffer ) Image_Process( &pic, 0, 0, 0.0f, img_flags, filter ); + if( pic->buffer ) Image_Process( &pic, 0, 0, img_flags, filter ); if( tex->flags & TF_LUMINANCE ) { @@ -1407,7 +1407,7 @@ int GL_LoadTextureArray( const char **names, int flags, imgfilter_t *filter ) // but allow to rescale raw images if( ImageRAW( pic->type ) && ImageRAW( src->type ) && ( pic->width != src->width || pic->height != src->height )) - Image_Process( &src, pic->width, pic->height, 0.0f, IMAGE_RESAMPLE, NULL ); + Image_Process( &src, pic->width, pic->height, IMAGE_RESAMPLE, NULL ); if( pic->size != src->size ) { @@ -1710,7 +1710,7 @@ void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor ) // all the operations makes over the image copy not an original pic = FS_CopyImage( image->original ); - Image_Process( &pic, topColor, bottomColor, gamma, flags, NULL ); + Image_Process( &pic, topColor, bottomColor, flags, NULL ); GL_UploadTexture( image, pic ); GL_ApplyTextureParams( image ); // update texture filter, wrap etc diff --git a/engine/client/gl_local.h b/engine/client/gl_local.h index 1ef2b392..c6c09605 100644 --- a/engine/client/gl_local.h +++ b/engine/client/gl_local.h @@ -344,6 +344,7 @@ void R_MarkLights( dlight_t *light, int bit, mnode_t *node ); void R_LightForPoint( const vec3_t point, color24 *ambientLight, qboolean invLight, qboolean useAmbient, float radius ); colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lightspot ); int R_CountSurfaceDlights( msurface_t *surf ); +colorVec R_LightPoint( const vec3_t p0 ); int R_CountDlights( void ); // @@ -678,6 +679,7 @@ extern convar_t *r_fastsky; extern convar_t *vid_displayfrequency; extern convar_t *vid_fullscreen; +extern convar_t *vid_brightness; extern convar_t *vid_gamma; extern convar_t *vid_mode; diff --git a/engine/client/gl_rlight.c b/engine/client/gl_rlight.c index f9418685..23449dc3 100644 --- a/engine/client/gl_rlight.c +++ b/engine/client/gl_rlight.c @@ -308,9 +308,9 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, { uint scale = tr.lightstylevalue[surf->styles[map]]; - cv->r += TextureToTexGamma( lm->r ) * scale; - cv->g += TextureToTexGamma( lm->g ) * scale; - cv->b += TextureToTexGamma( lm->b ) * scale; + cv->r += LightToTexGamma( lm->r ) * scale; + cv->g += LightToTexGamma( lm->g ) * scale; + cv->b += LightToTexGamma( lm->b ) * scale; lm += size; // skip to next lightmap } @@ -350,9 +350,9 @@ void R_LightForPoint( const vec3_t point, color24 *ambientLight, qboolean invLig // set to full bright if no light data if( !cl.worldmodel || !cl.worldmodel->lightdata ) { - ambientLight->r = TextureToTexGamma( clgame.movevars.skycolor_r ); - ambientLight->g = TextureToTexGamma( clgame.movevars.skycolor_g ); - ambientLight->b = TextureToTexGamma( clgame.movevars.skycolor_b ); + ambientLight->r = LightToTexGamma( clgame.movevars.skycolor_r ); + ambientLight->g = LightToTexGamma( clgame.movevars.skycolor_g ); + ambientLight->b = LightToTexGamma( clgame.movevars.skycolor_b ); return; } @@ -460,9 +460,9 @@ get_light: continue; add = 1.0f - (dist / ( dl->radius + radius )); - light.r += TextureToTexGamma( dl->color.r ) * add; - light.g += TextureToTexGamma( dl->color.g ) * add; - light.b += TextureToTexGamma( dl->color.b ) * add; + light.r += LightToTexGamma( dl->color.r ) * add; + light.g += LightToTexGamma( dl->color.g ) * add; + light.b += LightToTexGamma( dl->color.b ) * add; total++; } @@ -557,4 +557,20 @@ colorVec R_LightVec( const vec3_t start, const vec3_t end, vec3_t lspot ) } return light; +} + +/* +================= +R_LightPoint + +light from floor +================= +*/ +colorVec R_LightPoint( const vec3_t p0 ) +{ + vec3_t p1; + + VectorSet( p1, p0[0], p0[1], p0[2] - 2048.0f ); + + return R_LightVec( p0, p1, NULL ); } \ No newline at end of file diff --git a/engine/client/gl_rmain.c b/engine/client/gl_rmain.c index 34f4200c..25250afb 100644 --- a/engine/client/gl_rmain.c +++ b/engine/client/gl_rmain.c @@ -1068,7 +1068,7 @@ void R_BeginFrame( qboolean clearScene ) } // update gamma - if( FBitSet( vid_gamma->flags, FCVAR_CHANGED )) + if( FBitSet( vid_gamma->flags, FCVAR_CHANGED ) || FBitSet( vid_brightness->flags, FCVAR_CHANGED )) { if( glConfig.deviceSupportsGamma ) { @@ -1078,8 +1078,8 @@ void R_BeginFrame( qboolean clearScene ) } else { + BuildGammaTable( vid_gamma->value, vid_brightness->value ); glConfig.softwareGammaUpdate = true; - BuildGammaTable( vid_gamma->value, GAMMA ); GL_RebuildLightmaps(); glConfig.softwareGammaUpdate = false; } @@ -1502,7 +1502,7 @@ static render_api_t gRenderAPI = CL_GetLightStyle, CL_GetDynamicLight, CL_GetEntityLight, - TextureToTexGamma, + LightToTexGamma, CL_GetBeamChains, R_SetCurrentEntity, R_SetCurrentModel, diff --git a/engine/client/gl_rsurf.c b/engine/client/gl_rsurf.c index 3462e0dd..56a679c5 100644 --- a/engine/client/gl_rsurf.c +++ b/engine/client/gl_rsurf.c @@ -495,7 +495,7 @@ void R_AddDynamicLights( msurface_t *surf ) for( lnum = 0; lnum < MAX_DLIGHTS; lnum++ ) { - if(!( surf->dlightbits & BIT( lnum ))) + if( !FBitSet( surf->dlightbits, BIT( lnum ))) continue; // not lit by this light dl = &cl_dlights[lnum]; @@ -542,9 +542,9 @@ void R_AddDynamicLights( msurface_t *surf ) if( dist < minlight ) { - bl[0] += ( rad - dist ) * TextureToTexGamma( dl->color.r ); - bl[1] += ( rad - dist ) * TextureToTexGamma( dl->color.g ); - bl[2] += ( rad - dist ) * TextureToTexGamma( dl->color.b ); + bl[0] += ((int)((rad - dist) * 256) * dl->color.r) / 256; + bl[1] += ((int)((rad - dist) * 256) * dl->color.g) / 256; + bl[2] += ((int)((rad - dist) * 256) * dl->color.b) / 256; } } } @@ -690,9 +690,9 @@ static void R_BuildLightMap( msurface_t *surf, byte *dest, int stride, qboolean for( i = 0, bl = r_blocklights; i < size; i++, bl += 3, lm++ ) { - bl[0] += TextureToTexGamma( lm->r ) * scale; - bl[1] += TextureToTexGamma( lm->g ) * scale; - bl[2] += TextureToTexGamma( lm->b ) * scale; + bl[0] += LightToTexGamma( lm->r ) * scale; + bl[1] += LightToTexGamma( lm->g ) * scale; + bl[2] += LightToTexGamma( lm->b ) * scale; } } @@ -2067,6 +2067,8 @@ void GL_RebuildLightmaps( void ) model_t *m; if( !cl.world ) return; // wait for worldmodel + + ClearBits( vid_brightness->flags, FCVAR_CHANGED ); ClearBits( vid_gamma->flags, FCVAR_CHANGED ); // release old lightmaps diff --git a/engine/client/gl_sprite.c b/engine/client/gl_sprite.c index 03d86189..bc4d71e8 100644 --- a/engine/client/gl_sprite.c +++ b/engine/client/gl_sprite.c @@ -316,7 +316,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean if( h < MAPSPRITE_SIZE ) h = MAPSPRITE_SIZE; // resample image if needed - Image_Process( &pix, w, h, 0.0f, IMAGE_FORCE_RGBA|IMAGE_RESAMPLE, NULL ); + Image_Process( &pix, w, h, IMAGE_FORCE_RGBA|IMAGE_RESAMPLE, NULL ); w = h = MAPSPRITE_SIZE; diff --git a/engine/client/gl_studio.c b/engine/client/gl_studio.c index dba9a9e7..2b2bc392 100644 --- a/engine/client/gl_studio.c +++ b/engine/client/gl_studio.c @@ -1608,9 +1608,9 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight ) { VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z ); - light.r = mv->skycolor_r; - light.g = mv->skycolor_g; - light.b = mv->skycolor_b; + light.r = LightToTexGamma( mv->skycolor_r ); + light.g = LightToTexGamma( mv->skycolor_g ); + light.b = LightToTexGamma( mv->skycolor_b ); } } @@ -1690,9 +1690,9 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight ) VectorAdd( lightDir, dist, lightDir ); - finalLight[0] += dl->color.r * ( add / 256.0f ); - finalLight[1] += dl->color.g * ( add / 256.0f ); - finalLight[2] += dl->color.b * ( add / 256.0f ); + finalLight[0] += LightToTexGamma( dl->color.r ) * ( add / 256.0f ); + finalLight[1] += LightToTexGamma( dl->color.g ) * ( add / 256.0f ); + finalLight[2] += LightToTexGamma( dl->color.b ) * ( add / 256.0f ); } } @@ -1841,6 +1841,7 @@ R_StudioLighting void R_StudioLighting( float *lv, int bone, int flags, vec3_t normal ) { float illum; + int light; if( FBitSet( flags, STUDIO_NF_FULLBRIGHT )) { @@ -1885,7 +1886,8 @@ void R_StudioLighting( float *lv, int bone, int flags, vec3_t normal ) } illum = Q_min( illum, 255.0f ); - *lv = illum * (1.0f / 255.0f); + light = LightToTexGamma( illum ); + *lv = light * (1.0f / 255.0f); } /* diff --git a/engine/client/gl_vidnt.c b/engine/client/gl_vidnt.c index a04014d1..dd268943 100644 --- a/engine/client/gl_vidnt.c +++ b/engine/client/gl_vidnt.c @@ -77,6 +77,7 @@ convar_t *r_fastsky; convar_t *vid_displayfrequency; convar_t *vid_fullscreen; +convar_t *vid_brightness; convar_t *vid_gamma; convar_t *vid_mode; @@ -973,7 +974,7 @@ void VID_StartupGamma( void ) if( gl_ignorehwgamma->value ) { glConfig.deviceSupportsGamma = false; // even if supported! - BuildGammaTable( vid_gamma->value, GAMMA ); + BuildGammaTable( vid_gamma->value, vid_brightness->value ); MsgDev( D_NOTE, "VID_StartupGamma: software gamma initialized\n" ); return; } @@ -1041,6 +1042,7 @@ void VID_StartupGamma( void ) Mem_Free( savedGamma ); } + SetBits( vid_brightness->flags, FCVAR_CHANGED ); SetBits( vid_gamma->flags, FCVAR_CHANGED ); } @@ -1791,6 +1793,7 @@ void GL_InitCommands( void ) SetBits( gl_vsync->flags, FCVAR_CHANGED ); vid_gamma = Cvar_Get( "gamma", "1.0", FCVAR_ARCHIVE, "gamma amount" ); + vid_brightness = Cvar_Get( "brightness", "1.0", FCVAR_ARCHIVE, "brighntess factor" ); vid_mode = Cvar_Get( "vid_mode", VID_AUTOMODE, FCVAR_RENDERINFO, "display resolution mode" ); vid_fullscreen = Cvar_Get( "fullscreen", "0", FCVAR_RENDERINFO, "set in 1 to enable fullscreen mode" ); vid_displayfrequency = Cvar_Get ( "vid_displayfrequency", "0", FCVAR_RENDERINFO, "fullscreen refresh rate" ); diff --git a/engine/common/common.h b/engine/common/common.h index 6674912c..aaaf3f63 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -551,7 +551,7 @@ qboolean FS_SaveImage( const char *filename, rgbdata_t *pix ); rgbdata_t *FS_CopyImage( rgbdata_t *in ); void FS_FreeImage( rgbdata_t *pack ); extern const bpc_desc_t PFDesc[]; // image get pixelformat -qboolean Image_Process( rgbdata_t **pix, int width, int height, float gamma, uint flags, imgfilter_t *filter ); +qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgfilter_t *filter ); void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end ); void Image_SetForceFlags( uint flags ); // set image force flags on loading size_t Image_DXTGetLinearSize( int type, int width, int height, int depth ); @@ -906,8 +906,8 @@ void S_StopBackgroundTrack( void ); void S_StopAllSounds( void ); // gamma routines -void BuildGammaTable( float gamma, float texGamma ); -byte TextureToTexGamma( byte b ); +void BuildGammaTable( float gamma, float brightness ); +byte LightToTexGamma( byte b ); byte TextureToGamma( byte b ); #ifdef __cplusplus diff --git a/engine/common/console.c b/engine/common/console.c index 08afdac6..0bdc3aeb 100644 --- a/engine/common/console.c +++ b/engine/common/console.c @@ -469,7 +469,7 @@ void Con_CheckResize( void ) charWidth = con.curFont->charWidths['M'] - 1; width = ( glState.width / charWidth ) - 2; - if( !glw_state.initialized ) width = 78; + if( !glw_state.initialized ) width = (640 / 5); if( width == con.linewidth ) return; diff --git a/engine/common/gamma.c b/engine/common/gamma.c index c0632896..234df02b 100644 --- a/engine/common/gamma.c +++ b/engine/common/gamma.c @@ -20,42 +20,70 @@ GNU General Public License for more details. //----------------------------------------------------------------------------- // Gamma conversion support //----------------------------------------------------------------------------- -static byte gammatable[256]; static byte texgammatable[256]; // palette is sent through this to convert to screen gamma +static byte lightgammatable[256]; +static int lineargammatable[1024]; +static int screengammatable[1024]; -void BuildGammaTable( float gamma, float texGamma ) +void BuildGammaTable( float lightgamma, float brightness ) { int i, inf; - float g1, g = gamma; - double f; + float f, g, g1, g3; - g = bound( 1.8f, g, 3.0f ); - texGamma = bound( 1.8f, texGamma, 3.0f ); + lightgamma = bound( 1.8f, lightgamma, 3.0f ); + brightness = bound( 0.0f, brightness, 3.0f ); - g = 1.0f / g; - g1 = texGamma * g; + if( brightness <= 0.0f ) + g3 = 0.125f; + else if( brightness > 1.0f ) + g3 = 0.05f; + else g3 = 0.125f - (brightness * brightness) * 0.075f; + + g = 1.0f / lightgamma; + g1 = GAMMA * g; for( i = 0; i < 256; i++ ) { - inf = 255 * pow( i / 255.f, g1 ); + f = pow( i / 255.f, GAMMA ); + + // scale up + if( brightness > 1.0f ) + f = f * brightness; + + // shift up + if( f <= g3 ) f = (f / g3) * 0.125f; + else f = 0.125f + ((f - g3) / (1.0f - g3)) * 0.875f; + + // convert linear space to desired gamma space + inf = (int)( 255.0 * pow( f, g )); + + lightgammatable[i] = bound( 0, inf, 255 ); + } + + for( i = 0; i < 256; i++ ) + { + f = 255.0 * pow(( float )i / 255.0f, g1 ); + inf = (int)(f + 0.5f); texgammatable[i] = bound( 0, inf, 255 ); } - for( i = 0; i < 256; i++ ) + for( i = 0; i < 1024; i++ ) { - f = 255.0 * pow(( float )i / 255.0f, 2.2f / texGamma ); - inf = (int)(f + 0.5f); - gammatable[i] = bound( 0, inf, 255 ); + // convert from screen gamma space to linear space + lineargammatable[i] = 1023 * pow( i / 1023.0, g1 ); + + // convert from linear gamma space to screen space + screengammatable[i] = 1023 * pow( i / 1023.0, 1.0 / g1 ); } } -byte TextureToTexGamma( byte b ) +byte LightToTexGamma( byte b ) { if( glConfig.deviceSupportsGamma ) return b; // passthrough b = bound( 0, b, 255 ); - return texgammatable[b]; + return lightgammatable[b]; } byte TextureToGamma( byte b ) @@ -64,5 +92,5 @@ byte TextureToGamma( byte b ) return b; // passthrough b = bound( 0, b, 255 ); - return gammatable[b]; + return texgammatable[b]; } \ No newline at end of file diff --git a/engine/common/imagelib/img_utils.c b/engine/common/imagelib/img_utils.c index 9509ca5e..87ed9ada 100644 --- a/engine/common/imagelib/img_utils.c +++ b/engine/common/imagelib/img_utils.c @@ -1372,31 +1372,19 @@ rgbdata_t *Image_DecompressInternal( rgbdata_t *pic ) return pic; } -rgbdata_t *Image_LightGamma( rgbdata_t *pic, float texGamma ) +rgbdata_t *Image_LightGamma( rgbdata_t *pic ) { byte *in = (byte *)pic->buffer; - byte gammatable[256]; - int i, inf; - double f; + int i; if( pic->type != PF_RGBA_32 ) return pic; - texGamma = bound( 1.8f, texGamma, 3.0f ); - - // build the gamma table - for( i = 0; i < 256; i++ ) - { - f = 255.0 * pow(( float )i / 255.0f, 2.2f / texGamma ); - inf = (int)(f + 0.5f); - gammatable[i] = bound( 0, inf, 255 ); - } - for( i = 0; i < pic->width * pic->height; i++, in += 4 ) { - in[0] = gammatable[in[0]]; - in[1] = gammatable[in[1]]; - in[2] = gammatable[in[2]]; + in[0] = LightToTexGamma( in[0] ); + in[1] = LightToTexGamma( in[1] ); + in[2] = LightToTexGamma( in[2] ); } return pic; @@ -1550,7 +1538,7 @@ qboolean Image_ApplyFilter( rgbdata_t *pic, int filter, float factor, float bias return true; } -qboolean Image_Process( rgbdata_t **pix, int width, int height, float gamma, uint flags, imgfilter_t *filter ) +qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, imgfilter_t *filter ) { rgbdata_t *pic = *pix; qboolean result = true; @@ -1587,7 +1575,7 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, float gamma, uin // update format to RGBA if any if( flags & IMAGE_FORCE_RGBA ) pic = Image_DecompressInternal( pic ); - if( flags & IMAGE_LIGHTGAMMA ) pic = Image_LightGamma( pic, gamma ); + if( flags & IMAGE_LIGHTGAMMA ) pic = Image_LightGamma( pic ); if( filter ) Image_ApplyFilter( pic, filter->filter, filter->factor, filter->bias, filter->flags, filter->blendFunc ); diff --git a/mainui/menu_vidoptions.cpp b/mainui/menu_vidoptions.cpp index 2fdc3976..5f5a9fb3 100644 --- a/mainui/menu_vidoptions.cpp +++ b/mainui/menu_vidoptions.cpp @@ -66,12 +66,12 @@ UI_VidOptions_GetConfig static void UI_VidOptions_GetConfig( void ) { uiVidOptions.screenSize.curValue = RemapVal( CVAR_GET_FLOAT( "viewsize" ), 30.0f, 120.0f, 0.0f, 1.0f ); - uiVidOptions.glareReduction.curValue = (CVAR_GET_FLOAT( "r_flaresize" ) - 100.0f ) / 200.0f; + uiVidOptions.glareReduction.curValue = CVAR_GET_FLOAT( "brightness" ); if( CVAR_GET_FLOAT( "gl_ignorehwgamma" )) { uiVidOptions.gammaIntensity.curValue = RemapVal( CVAR_GET_FLOAT( "gamma" ), 1.8f, 3.0f, 0.0f, 1.0f ); - PIC_SetGamma( uiVidOptions.hTestImage, CVAR_GET_FLOAT( "gamma" )); + PIC_SetGamma( uiVidOptions.hTestImage, 1.0f ); } else uiVidOptions.gammaIntensity.curValue = RemapVal( CVAR_GET_FLOAT( "gamma" ), 0.5f, 2.3f, 0.0f, 1.0f ); @@ -93,19 +93,22 @@ UI_VidOptions_UpdateConfig static void UI_VidOptions_UpdateConfig( void ) { CVAR_SET_FLOAT( "viewsize", RemapVal( uiVidOptions.screenSize.curValue, 0.0f, 1.0f, 30.0f, 120.0f )); - CVAR_SET_FLOAT( "r_flaresize", (uiVidOptions.glareReduction.curValue * 200.0f ) + 100.0f ); + CVAR_SET_FLOAT( "brightness", uiVidOptions.glareReduction.curValue ); CVAR_SET_FLOAT( "r_fastsky", uiVidOptions.fastSky.enabled ); CVAR_SET_FLOAT( "host_allow_materials", uiVidOptions.hiTextures.enabled ); if( CVAR_GET_FLOAT( "gl_ignorehwgamma" )) - PIC_SetGamma( uiVidOptions.hTestImage, RemapVal( uiVidOptions.gammaIntensity.curValue, 0.0f, 1.0f, 1.8f, 3.0f )); + { + CVAR_SET_FLOAT( "gamma", RemapVal( uiVidOptions.gammaIntensity.curValue, 0.0f, 1.0f, 1.8f, 3.0f )); + PIC_SetGamma( uiVidOptions.hTestImage, 1.0f ); + } else CVAR_SET_FLOAT( "gamma", RemapVal( uiVidOptions.gammaIntensity.curValue, 0.0f, 1.0f, 0.5f, 2.3f )); } static void UI_VidOptions_SetConfig( void ) { CVAR_SET_FLOAT( "viewsize", RemapVal( uiVidOptions.screenSize.curValue, 0.0f, 1.0f, 30.0f, 120.0f )); - CVAR_SET_FLOAT( "r_flaresize", (uiVidOptions.glareReduction.curValue * 200.0f ) + 100.0f ); + CVAR_SET_FLOAT( "brightness", uiVidOptions.glareReduction.curValue ); CVAR_SET_FLOAT( "r_fastsky", uiVidOptions.fastSky.enabled ); CVAR_SET_FLOAT( "host_allow_materials", uiVidOptions.hiTextures.enabled );