Skip to content

Commit 13ea74a

Browse files
committed
tr_image: add _null image
1 parent a8c33ea commit 13ea74a

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/engine/renderer/tr_image.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2758,6 +2758,11 @@ void R_CreateBuiltinImages()
27582758

27592759
tr.blueImage = R_CreateImage( "_blue", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
27602760

2761+
// null
2762+
memset( data, 0, sizeof( data ) );
2763+
2764+
tr.nullImage = R_CreateImage( "_null", ( const byte ** ) &dataPtr, 1, 1, 1, imageParams );
2765+
27612766
// generate a default normalmap with a fully opaque heightmap (no displacement)
27622767
Vector4Set( data, 128, 128, 255, 255 );
27632768

src/engine/renderer/tr_local.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,6 +2447,7 @@ enum
24472447
image_t *redImage;
24482448
image_t *greenImage;
24492449
image_t *blueImage;
2450+
image_t *nullImage; // full of 0x0
24502451
image_t *flatImage; // use this as default normalmap
24512452
image_t *blackCubeImage;
24522453
image_t *whiteCubeImage;

src/engine/renderer/tr_shader.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,12 @@ static bool LoadMap( shaderStage_t *stage, const char *buffer, stageType_t type,
14641464
stage->bundle[ bundleIndex ].image[ 0 ] = tr.blueImage;
14651465
return true;
14661466
}
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+
}
14671473
else if ( !Q_stricmp( token, "$flatimage" ) || !Q_stricmp( token, "$flat" )
14681474
|| !Q_stricmp( token, "_flat" ) || !Q_stricmp( token, "*flat" ) )
14691475
{

0 commit comments

Comments
 (0)