Fixed PBR _rmao lookup hack on the wrong textures. Close #905

This commit is contained in:
Robert Beckebans 2024-06-28 13:48:02 +02:00
parent 504e7f5591
commit c226650c0c
3 changed files with 24 additions and 7 deletions

View file

@ -1035,12 +1035,16 @@ void R_LoadImage( const char* cname, byte** pic, int* width, int* height, ID_TIM
if( name.StripTrailingOnce( "_s" ) )
{
name += "_rmao";
ext = "png";
name.DefaultFileExtension( ".png" );
pbrImageLookup = true;
}
else
{
name = origName;
}
ext = "png";
name.DefaultFileExtension( ".png" );
pbrImageLookup = true;
}
#if 0
else if( usage && *usage == TD_R11G11B10F )

View file

@ -390,9 +390,12 @@ void idImage::FinalizeImage( bool fromBackEnd, nvrhi::ICommandList* commandList
// RB: PBR HACK - RMAO maps should end with _rmao insted of _s
if( usage == TD_SPECULAR_PBR_RMAO )
{
if( imgName.StripTrailingOnce( "_s" ) )
idStr baseName = imgName;
baseName.StripFileExtension();
if( baseName.StripTrailingOnce( "_s" ) )
{
imgName += "_rmao";
imgName = baseName + "_rmao";
}
}
// RB end

View file

@ -134,6 +134,16 @@ idImage::idImage( const char* name ) : imgName( name )
binaryFileTime = FILE_NOT_FOUND_TIMESTAMP;
refCount = 0;
#if 0
// debugging code
idStr ext;
imgName.ExtractFileExtension( ext );
if( ext.Length() > 0 )
{
common->Printf( "Image %s has extension\n", imgName.c_str() );
}
#endif
DeferredLoadImage();
}