Skip to content

Commit 06c909b

Browse files
committed
renderer: introduce and use IF_NOALPHA
1 parent d335c94 commit 06c909b

File tree

3 files changed

+15
-17
lines changed

3 files changed

+15
-17
lines changed

src/engine/renderer/tr_bsp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@ static void R_LoadLightmaps( lump_t *l, const char *bspName )
483483
return;
484484
}
485485

486-
int lightMapBits = IF_LIGHTMAP | IF_NOPICMIP;
487-
int deluxeMapBits = IF_NORMALMAP | IF_NOPICMIP;
486+
int lightMapBits = IF_LIGHTMAP | IF_NOALPHA | IF_NOPICMIP;
487+
int deluxeMapBits = IF_NORMALMAP | IF_NOALPHA | IF_NOPICMIP;
488488

489489
if ( tr.worldLinearizeLightMap )
490490
{

src/engine/renderer/tr_image.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,17 +1054,14 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
10541054
}
10551055
else
10561056
{
1057-
// lightmap does not have alpha channel
1058-
if ( image->bits & IF_LIGHTMAP )
1059-
{
1060-
internalFormat = GL_RGB8;
1061-
}
1062-
else
1063-
{
1064-
internalFormat = GL_RGBA8;
1065-
}
1057+
internalFormat = GL_RGBA8;
10661058
}
10671059

1060+
if ( internalFormat == GL_RGBA8 && image->bits & IF_NOALPHA )
1061+
{
1062+
internalFormat = GL_RGB8;
1063+
}
1064+
10681065
if ( internalFormat == GL_RGB8 )
10691066
{
10701067
c = image->width * image->height;
@@ -2776,13 +2773,13 @@ void R_CreateBuiltinImages()
27762773
memset( data, 255, sizeof( data ) );
27772774

27782775
imageParams_t imageParams = {};
2779-
imageParams.bits = IF_NOPICMIP;
2776+
imageParams.bits = IF_NOPICMIP | IF_NOALPHA;
27802777
imageParams.filterType = filterType_t::FT_LINEAR;
27812778
imageParams.wrapType = wrapTypeEnum_t::WT_REPEAT;
27822779

27832780
tr.whiteImage = R_CreateImage( "_white", ( const byte ** ) &dataPtr, DIMENSION, DIMENSION, 1, imageParams );
27842781

2785-
imageParams.bits = IF_NOPICMIP | IF_RED;
2782+
imageParams.bits = IF_NOPICMIP | IF_NOALPHA | IF_RED;
27862783

27872784
// we use a solid black image instead of disabling texturing
27882785
memset( data, 0, sizeof( data ) );
@@ -2804,7 +2801,7 @@ void R_CreateBuiltinImages()
28042801
out[ 1 ] = out[ 3 ] = 255;
28052802
}
28062803

2807-
imageParams.bits = IF_NOPICMIP;
2804+
imageParams.bits = IF_NOPICMIP | IF_NOALPHA;
28082805

28092806
tr.greenImage = R_CreateImage( "_green", ( const byte ** ) &dataPtr, DIMENSION, DIMENSION, 1, imageParams );
28102807

@@ -2825,11 +2822,11 @@ void R_CreateBuiltinImages()
28252822
out[ 3 ] = 255;
28262823
}
28272824

2828-
imageParams.bits = IF_NOPICMIP | IF_NORMALMAP;
2825+
imageParams.bits = IF_NOPICMIP | IF_NOALPHA | IF_NORMALMAP;
28292826

28302827
tr.flatImage = R_CreateImage( "_flat", ( const byte ** ) &dataPtr, DIMENSION, DIMENSION, 1, imageParams );
28312828

2832-
imageParams.bits = IF_NOPICMIP;
2829+
imageParams.bits = IF_NOPICMIP | IF_NOALPHA;
28332830
imageParams.wrapType = wrapTypeEnum_t::WT_CLAMP;
28342831

28352832
for ( image_t * &image : tr.cinematicImage )

src/engine/renderer/tr_local.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,8 @@ enum class ssaoMode {
484484
IF_BC4 = BIT( 22 ),
485485
IF_BC5 = BIT( 23 ),
486486
IF_RGBA32UI = BIT( 24 ),
487-
IF_HOMEPATH = BIT( 25 )
487+
IF_HOMEPATH = BIT( 25 ),
488+
IF_NOALPHA = BIT( 26 )
488489
};
489490

490491
enum class filterType_t

0 commit comments

Comments
 (0)