r_mapBrightness can now be used with r_fullbright for lightmapped surfaces

This commit is contained in:
myT 2020-02-27 05:26:19 +01:00
parent 69d6cdf42b
commit ae30c5a311
4 changed files with 8 additions and 2 deletions

View file

@ -134,6 +134,7 @@ chg: r_lightmap is now latched again
chg: r_fullbright is now latched again
it now also supports surfaces referencing q3map2's "external lightmap" atlas images
r_mapBrightness is now used by r_fullbright for lightmapped surfaces when r_vertexLight is 0
chg: negative r_swapInterval values will request adaptive V-Sync when using an OpenGL back-end

View file

@ -988,6 +988,10 @@ static void R_CreateBuiltinImages()
Com_Memset( data, 255, 4 );
tr.whiteImage = R_CreateImage( "*white", data, 1, 1, TF_RGBA8, IMG_NOMIPMAP | IMG_NOAF, TW_REPEAT );
const byte mapBrightness = (byte)( min( r_mapBrightness->value, 1.0f ) * 255.0f );
data[0] = data[1] = data[2] = mapBrightness;
tr.fullBrightImage = R_CreateImage( "*fullBright", data, 1, 1, TF_RGBA8, IMG_NOMIPMAP | IMG_NOAF, TW_REPEAT );
// scratchimages usually used for cinematic drawing (signal-quality effects)
// these are just placeholders: RE_StretchRaw will regenerate them when it wants them
for (i = 0; i < ARRAY_LEN(tr.scratchImage); ++i)

View file

@ -861,7 +861,8 @@ typedef struct {
const byte* externalVisData; // from RE_SetWorldVisData, shared with CM_Load
image_t* defaultImage;
image_t* whiteImage; // { 255, 255, 255, 255 }
image_t* whiteImage; // { 255, 255, 255, 255 }
image_t* fullBrightImage; // RGB scale based on r_mapBrightness, alpha 255
image_t* fogImage;
image_t* scratchImage[16]; // MAX_VIDEO_HANDLES

View file

@ -2125,7 +2125,7 @@ static shader_t* FinishShader()
for ( int i = 0; i < shader.numStages; ++i ) {
if ( UsesInternalLightmap( &stages[i] ) || UsesExternalLightmap( &stages[i] ) ) {
stages[i].type = ST_DIFFUSE;
stages[i].bundle.image[0] = tr.whiteImage;
stages[i].bundle.image[0] = tr.fullBrightImage;
}
}
} else if (