Skip to content

Commit d71246d

Browse files
committed
renderer: simplify builtin image name parsing
1 parent 13ea74a commit d71246d

File tree

2 files changed

+9
-45
lines changed

2 files changed

+9
-45
lines changed

src/engine/renderer/tr_image.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2736,39 +2736,39 @@ void R_CreateBuiltinImages()
27362736
imageParams.filterType = filterType_t::FT_LINEAR;
27372737
imageParams.wrapType = wrapTypeEnum_t::WT_REPEAT;
27382738

2739-
tr.whiteImage = R_CreateImage( "_white", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2739+
tr.whiteImage = R_CreateImage( "$whiteimage", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27402740

27412741
// we use a solid black image instead of disabling texturing
27422742
Vector4Set( data, 0, 0, 0, 255 );
27432743

2744-
tr.blackImage = R_CreateImage( "_black", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2744+
tr.blackImage = R_CreateImage( "$blackimage", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27452745

27462746
// red
27472747
Vector4Set( data, 255, 0, 0, 255 );
27482748

2749-
tr.redImage = R_CreateImage( "_red", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2749+
tr.redImage = R_CreateImage( "$redimage", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27502750

27512751
// green
27522752
Vector4Set( data, 0, 255, 0, 255 );
27532753

2754-
tr.greenImage = R_CreateImage( "_green", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2754+
tr.greenImage = R_CreateImage( "$greenimage", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27552755

27562756
// blue
27572757
Vector4Set( data, 0, 0, 255, 255 );
27582758

2759-
tr.blueImage = R_CreateImage( "_blue", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2759+
tr.blueImage = R_CreateImage( "$blueimage", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27602760

27612761
// null
27622762
memset( data, 0, sizeof( data ) );
27632763

2764-
tr.nullImage = R_CreateImage( "_null", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2764+
tr.nullImage = R_CreateImage( "$nullimage", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27652765

27662766
// generate a default normalmap with a fully opaque heightmap (no displacement)
27672767
Vector4Set( data, 128, 128, 255, 255 );
27682768

27692769
imageParams.bits = IF_NOPICMIP | IF_NORMALMAP;
27702770

2771-
tr.flatImage = R_CreateImage( "_flat", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2771+
tr.flatImage = R_CreateImage( "$flatimage", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27722772

27732773
imageParams.bits = IF_NOPICMIP;
27742774
imageParams.wrapType = wrapTypeEnum_t::WT_CLAMP;

src/engine/renderer/tr_shader.cpp

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,48 +1434,12 @@ 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" )
1438-
|| !Q_stricmp( token, "_white" ) || !Q_stricmp( token, "*white" ) )
1437+
// Quake III backward compatibility.
1438+
if ( !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" )
1444-
|| !Q_stricmp( token, "_black" ) || !Q_stricmp( token, "*black" ) )
1445-
{
1446-
stage->bundle[ bundleIndex ].image[ 0 ] = tr.blackImage;
1447-
return true;
1448-
}
1449-
else if ( !Q_stricmp( token, "$redimage" ) || !Q_stricmp( token, "$red" )
1450-
|| !Q_stricmp( token, "_red" ) || !Q_stricmp( token, "*red" ) )
1451-
{
1452-
stage->bundle[ bundleIndex ].image[ 0 ] = tr.redImage;
1453-
return true;
1454-
}
1455-
else if ( !Q_stricmp( token, "$greenimage" ) || !Q_stricmp( token, "$green" )
1456-
|| !Q_stricmp( token, "_green" ) || !Q_stricmp( token, "*green" ) )
1457-
{
1458-
stage->bundle[ bundleIndex ].image[ 0 ] = tr.greenImage;
1459-
return true;
1460-
}
1461-
else if ( !Q_stricmp( token, "$blueimage" ) || !Q_stricmp( token, "$blue" )
1462-
|| !Q_stricmp( token, "_blue" ) || !Q_stricmp( token, "*blue" ) )
1463-
{
1464-
stage->bundle[ bundleIndex ].image[ 0 ] = tr.blueImage;
1465-
return true;
1466-
}
1467-
else if ( !Q_stricmp( token, "$nullimage" ) || !Q_stricmp( token, "$null" )
1468-
|| !Q_stricmp( token, "_null" ) || !Q_stricmp( token, "*null" ) )
1469-
{
1470-
stage->bundle[ bundleIndex ].image[ 0 ] = tr.nullImage;
1471-
return true;
1472-
}
1473-
else if ( !Q_stricmp( token, "$flatimage" ) || !Q_stricmp( token, "$flat" )
1474-
|| !Q_stricmp( token, "_flat" ) || !Q_stricmp( token, "*flat" ) )
1475-
{
1476-
stage->bundle[ bundleIndex ].image[ 0 ] = tr.flatImage;
1477-
return true;
1478-
}
14791443

14801444
else if ( !Q_stricmp( token, "$lightmap" ) )
14811445
{

0 commit comments

Comments
 (0)