Skip to content

Commit f6aba09

Browse files
committed
renderer: simplify builtin color image name parsing, rename as $name, forget about unused aliases
1 parent c8e138d commit f6aba09

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

src/engine/renderer/tr_image.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2764,34 +2764,34 @@ void R_CreateBuiltinImages()
27642764
imageParams.filterType = filterType_t::FT_LINEAR;
27652765
imageParams.wrapType = wrapTypeEnum_t::WT_REPEAT;
27662766

2767-
tr.whiteImage = R_CreateImage( "_white", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2767+
tr.whiteImage = R_CreateImage( "$white", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27682768

27692769
// we use a solid black image instead of disabling texturing
27702770
memset( data, 0, sizeof( data ) );
27712771

2772-
tr.blackImage = R_CreateImage( "_black", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2772+
tr.blackImage = R_CreateImage( "$black", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27732773

27742774
// red
27752775
Vector4Set( data, 255, 0, 0, 255 );
27762776

2777-
tr.redImage = R_CreateImage( "_red", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2777+
tr.redImage = R_CreateImage( "$red", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27782778

27792779
// green
27802780
Vector4Set( data, 0, 255, 0, 255 );
27812781

2782-
tr.greenImage = R_CreateImage( "_green", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2782+
tr.greenImage = R_CreateImage( "$green", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27832783

27842784
// blue
27852785
Vector4Set( data, 0, 0, 255, 255 );
27862786

2787-
tr.blueImage = R_CreateImage( "_blue", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2787+
tr.blueImage = R_CreateImage( "$blue", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27882788

27892789
// generate a default normalmap with a fully opaque heightmap (no displacement)
27902790
Vector4Set( data, 128, 128, 255, 255 );
27912791

27922792
imageParams.bits = IF_NOPICMIP | IF_NORMALMAP;
27932793

2794-
tr.flatImage = R_CreateImage( "_flat", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2794+
tr.flatImage = R_CreateImage( "$flat", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27952795

27962796
imageParams.bits = IF_NOPICMIP;
27972797
imageParams.wrapType = wrapTypeEnum_t::WT_CLAMP;

src/engine/renderer/tr_shader.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,24 +1434,19 @@ static bool LoadMap( shaderStage_t *stage, const char *buffer, stageType_t type,
14341434
return true;
14351435
}
14361436

1437-
if ( !Q_stricmp( token, "$whiteimage" ) || !Q_stricmp( token, "$white" ) || !Q_stricmp( token, "_white" ) ||
1438-
!Q_stricmp( token, "*white" ) )
1437+
// Quake III backward compatibility.
1438+
if ( !Q_stricmp( token, "$whiteimage" ) || !Q_stricmp( token, "*white" ) )
14391439
{
14401440
stage->bundle[ bundleIndex ].image[ 0 ] = tr.whiteImage;
14411441
return true;
14421442
}
1443-
else if ( !Q_stricmp( token, "$blackimage" ) || !Q_stricmp( token, "$black" ) || !Q_stricmp( token, "_black" ) ||
1444-
!Q_stricmp( token, "*black" ) )
1443+
1444+
// Other engine compatibility (old XeaL, QFusion…)
1445+
if ( !Q_stricmp( token, "$blackimage" ) || !Q_stricmp( token, "*black" ) )
14451446
{
14461447
stage->bundle[ bundleIndex ].image[ 0 ] = tr.blackImage;
14471448
return true;
14481449
}
1449-
else if ( !Q_stricmp( token, "$flatimage" ) || !Q_stricmp( token, "$flat" ) || !Q_stricmp( token, "_flat" ) ||
1450-
!Q_stricmp( token, "*flat" ) )
1451-
{
1452-
stage->bundle[ bundleIndex ].image[ 0 ] = tr.flatImage;
1453-
return true;
1454-
}
14551450

14561451
else if ( !Q_stricmp( token, "$lightmap" ) )
14571452
{

0 commit comments

Comments
 (0)