Skip to content

Commit 54e608a

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

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
@@ -2649,34 +2649,34 @@ void R_CreateBuiltinImages()
26492649
imageParams.filterType = filterType_t::FT_LINEAR;
26502650
imageParams.wrapType = wrapTypeEnum_t::WT_REPEAT;
26512651

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

26542654
// we use a solid black image instead of disabling texturing
26552655
memset( data, 0, sizeof( data ) );
26562656

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

26592659
// red
26602660
Vector4Set( data, 255, 0, 0, 255 );
26612661

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

26642664
// green
26652665
Vector4Set( data, 0, 255, 0, 255 );
26662666

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

26692669
// blue
26702670
Vector4Set( data, 0, 0, 255, 255 );
26712671

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

26742674
// generate a default normalmap with a fully opaque heightmap (no displacement)
26752675
Vector4Set( data, 128, 128, 255, 255 );
26762676

26772677
imageParams.bits = IF_NOPICMIP | IF_NORMALMAP;
26782678

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

26812681
imageParams.bits = IF_NOPICMIP;
26822682
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
@@ -1429,24 +1429,19 @@ static bool LoadMap( shaderStage_t *stage, const char *buffer, stageType_t type,
14291429
return true;
14301430
}
14311431

1432-
if ( !Q_stricmp( token, "$whiteimage" ) || !Q_stricmp( token, "$white" ) || !Q_stricmp( token, "_white" ) ||
1433-
!Q_stricmp( token, "*white" ) )
1432+
// Quake III backward compatibility.
1433+
if ( !Q_stricmp( token, "$whiteimage" ) || !Q_stricmp( token, "*white" ) )
14341434
{
14351435
stage->bundle[ bundleIndex ].image[ 0 ] = tr.whiteImage;
14361436
return true;
14371437
}
1438-
else if ( !Q_stricmp( token, "$blackimage" ) || !Q_stricmp( token, "$black" ) || !Q_stricmp( token, "_black" ) ||
1439-
!Q_stricmp( token, "*black" ) )
1438+
1439+
// Other engine compatibility (old XeaL, QFusion…)
1440+
if ( !Q_stricmp( token, "$blackimage" ) || !Q_stricmp( token, "*black" ) )
14401441
{
14411442
stage->bundle[ bundleIndex ].image[ 0 ] = tr.blackImage;
14421443
return true;
14431444
}
1444-
else if ( !Q_stricmp( token, "$flatimage" ) || !Q_stricmp( token, "$flat" ) || !Q_stricmp( token, "_flat" ) ||
1445-
!Q_stricmp( token, "*flat" ) )
1446-
{
1447-
stage->bundle[ bundleIndex ].image[ 0 ] = tr.flatImage;
1448-
return true;
1449-
}
14501445

14511446
else if ( !Q_stricmp( token, "$lightmap" ) )
14521447
{

0 commit comments

Comments
 (0)