mirror of
https://github.com/UberGames/lilium-voyager.git
synced 2025-01-06 00:40:43 +00:00
OpenGL2: Fix rendering when r_hdr = 0 and r_floatLightmap = 1
This commit is contained in:
parent
3cfc1bb1f9
commit
5fabc28dff
4 changed files with 13 additions and 11 deletions
|
@ -286,13 +286,10 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
|
||||||
tr.deluxemaps = ri.Hunk_Alloc( tr.numLightmaps * sizeof(image_t *), h_low );
|
tr.deluxemaps = ri.Hunk_Alloc( tr.numLightmaps * sizeof(image_t *), h_low );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_hdr->integer)
|
if (glRefConfig.floatLightmap)
|
||||||
{
|
textureInternalFormat = GL_RGBA16F_ARB;
|
||||||
if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer)
|
else
|
||||||
textureInternalFormat = GL_RGBA16F_ARB;
|
textureInternalFormat = GL_RGBA8;
|
||||||
else
|
|
||||||
textureInternalFormat = GL_RGBA8;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r_mergeLightmaps->integer)
|
if (r_mergeLightmaps->integer)
|
||||||
{
|
{
|
||||||
|
@ -405,12 +402,12 @@ static void R_LoadLightmaps( lump_t *l, lump_t *surfs ) {
|
||||||
|
|
||||||
R_ColorShiftLightingFloats(color, color, 1.0f/255.0f);
|
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]));
|
ColorToRGBA16F(color, (unsigned short *)(&image[j*8]));
|
||||||
else
|
else
|
||||||
ColorToRGBM(color, &image[j*4]);
|
ColorToRGBM(color, &image[j*4]);
|
||||||
}
|
}
|
||||||
else if (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer)
|
else if (glRefConfig.floatLightmap)
|
||||||
{
|
{
|
||||||
vec4_t color;
|
vec4_t color;
|
||||||
|
|
||||||
|
|
|
@ -725,4 +725,7 @@ void GLimp_InitExtraExtensions()
|
||||||
{
|
{
|
||||||
ri.Printf(PRINT_ALL, result[2], extension);
|
ri.Printf(PRINT_ALL, result[2], extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// use float lightmaps?
|
||||||
|
glRefConfig.floatLightmap = (glRefConfig.textureFloat && glRefConfig.halfFloatPixel && r_floatLightmap->integer && r_hdr->integer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -903,7 +903,7 @@ void GLSL_InitGPUShaders(void)
|
||||||
if (i & GENERICDEF_USE_LIGHTMAP)
|
if (i & GENERICDEF_USE_LIGHTMAP)
|
||||||
Q_strcat(extradefines, 1024, "#define USE_LIGHTMAP\n");
|
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");
|
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))
|
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)
|
if (1)
|
||||||
Q_strcat(extradefines, 1024, "#define SWIZZLE_NORMALMAP\n");
|
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");
|
Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n");
|
||||||
|
|
||||||
if (lightType)
|
if (lightType)
|
||||||
|
|
|
@ -1425,6 +1425,8 @@ typedef struct {
|
||||||
qboolean seamlessCubeMap;
|
qboolean seamlessCubeMap;
|
||||||
|
|
||||||
GLenum packedNormalDataType;
|
GLenum packedNormalDataType;
|
||||||
|
|
||||||
|
qboolean floatLightmap;
|
||||||
} glRefConfig_t;
|
} glRefConfig_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue