mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-15 07:00:58 +00:00
Added invertGreen( normalmap.png ) material keyword
This commit is contained in:
parent
9ce36e420a
commit
8f82bb0fb9
1 changed files with 35 additions and 0 deletions
|
@ -185,6 +185,24 @@ static void R_InvertAlpha( byte* data, int width, int height )
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_InvertGreen
|
||||
=================
|
||||
*/
|
||||
static void R_InvertGreen( byte* data, int width, int height )
|
||||
{
|
||||
int i;
|
||||
int c;
|
||||
|
||||
c = width * height * 4;
|
||||
|
||||
for( i = 0 ; i < c ; i += 4 )
|
||||
{
|
||||
data[i + 1] = 255 - data[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_InvertColor
|
||||
|
@ -608,6 +626,23 @@ static bool R_ParseImageProgram_r( idLexer& src, byte** pic, int* width, int* he
|
|||
return true;
|
||||
}
|
||||
|
||||
// RB: invertGreen to allow flipping the Y-Axis of normal maps
|
||||
if( !token.Icmp( "invertGreen" ) )
|
||||
{
|
||||
MatchAndAppendToken( src, "(" );
|
||||
|
||||
R_ParseImageProgram_r( src, pic, width, height, timestamps, usage );
|
||||
|
||||
// process it
|
||||
if( pic )
|
||||
{
|
||||
R_InvertGreen( *pic, *width, *height );
|
||||
}
|
||||
|
||||
MatchAndAppendToken( src, ")" );
|
||||
return true;
|
||||
}
|
||||
|
||||
if( !token.Icmp( "invertColor" ) )
|
||||
{
|
||||
MatchAndAppendToken( src, "(" );
|
||||
|
|
Loading…
Reference in a new issue