diff options
Diffstat (limited to 'src/renderergl2')
-rw-r--r-- | src/renderergl2/tr_bsp.c | 15 | ||||
-rw-r--r-- | src/renderergl2/tr_extensions.c | 3 | ||||
-rw-r--r-- | src/renderergl2/tr_glsl.c | 4 | ||||
-rw-r--r-- | src/renderergl2/tr_local.h | 2 |
4 files changed, 13 insertions, 11 deletions
diff --git a/src/renderergl2/tr_bsp.c b/src/renderergl2/tr_bsp.c index f800e46e..d4a44633 100644 --- a/src/renderergl2/tr_bsp.c +++ b/src/renderergl2/tr_bsp.c @@ -287,13 +287,10 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) { tr.deluxemaps = ri.Hunk_Alloc( tr.numLightmaps * sizeof(image_t *), h_low ); } - if (r_hdr->integer) - { - if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer) - textureInternalFormat = GL_RGBA16F_ARB; - else - textureInternalFormat = GL_RGBA8; - } + if (glRefConfig.floatLightmap) + textureInternalFormat = GL_RGBA16F_ARB; + else + textureInternalFormat = GL_RGBA8; if (r_mergeLightmaps->integer) { @@ -406,12 +403,12 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) { R_ColorShiftLightingFloats(color, color, 1.0f/255.0f); - if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer) + if (glRefConfig.floatLightmap) ColorToRGBA16F(color, (unsigned short *)(&image[j*8])); else ColorToRGBM(color, &image[j*4]); } - else if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer) + else if (glRefConfig.floatLightmap) { vec4_t color; diff --git a/src/renderergl2/tr_extensions.c b/src/renderergl2/tr_extensions.c index adca06e9..6b59de7c 100644 --- a/src/renderergl2/tr_extensions.c +++ b/src/renderergl2/tr_extensions.c @@ -725,4 +725,7 @@ void GLimp_InitExtraExtensions() { ri.Printf(PRINT_ALL, result[2], extension); } + + // use float lightmaps? + glRefConfig.floatLightmap = (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer && r_hdr->integer); } diff --git a/src/renderergl2/tr_glsl.c b/src/renderergl2/tr_glsl.c index 2212c4fe..4919254f 100644 --- a/src/renderergl2/tr_glsl.c +++ b/src/renderergl2/tr_glsl.c @@ -903,7 +903,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 && r_floatLightmap->integer)) + if (r_hdr->integer && !glRefConfig.floatLightmap) 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)) @@ -1022,7 +1022,7 @@ void GLSL_InitGPUShaders(void) if (1) Q_strcat(extradefines, 1024, "#define SWIZZLE_NORMALMAP\n"); - if (r_hdr->integer && !(glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer)) + if (r_hdr->integer && !glRefConfig.floatLightmap) Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n"); if (lightType) diff --git a/src/renderergl2/tr_local.h b/src/renderergl2/tr_local.h index c98ec28e..9a26e39d 100644 --- a/src/renderergl2/tr_local.h +++ b/src/renderergl2/tr_local.h @@ -1426,6 +1426,8 @@ typedef struct { qboolean seamlessCubeMap; GLenum packedNormalDataType; + + qboolean floatLightmap; } glRefConfig_t; |