OpenGL2: default to RGBM lightmap, and add r_floatLightmap for old behaviour.

This commit is contained in:
SmileTheory 2013-10-07 01:46:50 -07:00
parent acbeca6042
commit c6774cf113
4 changed files with 7 additions and 4 deletions

View File

@ -271,7 +271,7 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
if (r_hdr->integer)
{
if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel)
if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer)
textureInternalFormat = GL_RGBA16F_ARB;
else
textureInternalFormat = GL_RGBA8;
@ -410,7 +410,7 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
VectorScale(color, lightScale, color);
if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel)
if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer)
ColorToRGBA16F(color, (unsigned short *)(&image[j*8]));
else
ColorToRGBM(color, &image[j*4]);

View File

@ -905,7 +905,7 @@ void GLSL_InitGPUShaders(void)
if (i & GENERICDEF_USE_LIGHTMAP)
Q_strcat(extradefines, 1024, "#define USE_LIGHTMAP\n");
if (r_hdr->integer && !(glRefConfig.textureFloat && glRefConfig.halfFloatPixel))
if (r_hdr->integer && !(glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer))
Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n");
if (!GLSL_InitGPUShader(&tr.genericShader[i], "generic", attribs, qtrue, extradefines, qtrue, fallbackShader_generic_vp, fallbackShader_generic_fp))
@ -1034,7 +1034,7 @@ void GLSL_InitGPUShaders(void)
Q_strcat(extradefines, 1024, "#define SWIZZLE_NORMALMAP\n");
}
if (r_hdr->integer && !(glRefConfig.textureFloat && glRefConfig.halfFloatPixel))
if (r_hdr->integer && !(glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer))
Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n");
if (i & LIGHTDEF_LIGHTTYPE_MASK)

View File

@ -110,6 +110,7 @@ cvar_t *r_cameraExposure;
cvar_t *r_softOverbright;
cvar_t *r_hdr;
cvar_t *r_floatLightmap;
cvar_t *r_postProcess;
cvar_t *r_toneMap;
@ -1170,6 +1171,7 @@ void R_Register( void )
r_softOverbright = ri.Cvar_Get( "r_softOverbright", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_hdr = ri.Cvar_Get( "r_hdr", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_floatLightmap = ri.Cvar_Get( "r_floatLightmap", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_postProcess = ri.Cvar_Get( "r_postProcess", "1", CVAR_ARCHIVE );
r_toneMap = ri.Cvar_Get( "r_toneMap", "1", CVAR_ARCHIVE | CVAR_LATCH );

View File

@ -1958,6 +1958,7 @@ extern cvar_t *r_mergeLeafSurfaces;
extern cvar_t *r_softOverbright;
extern cvar_t *r_hdr;
extern cvar_t *r_floatLightmap;
extern cvar_t *r_postProcess;
extern cvar_t *r_toneMap;