Fix q3 compatibility bug with lightgrid and only one light.
Correct math requires the ambient component of the lightgrid to be zero in that case. However, q3 ignores lightgrid cells with all zero ambient value, EVEN if the directed value is nonzero. This change sets the ambient value to #010101 if it'd be pitch black. This should be a minimal change without affecting light hue that fixes lightgrid rendering. In engines like DarkPlaces, almost no map should look different from this. Fixes https://gitlab.com/xonotic/netradiant/-/issues/137
This commit is contained in:
parent
42ac0ccb61
commit
49b725a1b2
|
|
@ -1731,6 +1731,15 @@ void TraceGrid( int num ){
|
||||||
/* vortex: apply gridscale and gridambientscale here */
|
/* vortex: apply gridscale and gridambientscale here */
|
||||||
ColorToBytes( color, bgp->ambient[ i ], gridScale * gridAmbientScale );
|
ColorToBytes( color, bgp->ambient[ i ], gridScale * gridAmbientScale );
|
||||||
ColorToBytes( gp->directed[ i ], bgp->directed[ i ], gridScale );
|
ColorToBytes( gp->directed[ i ], bgp->directed[ i ], gridScale );
|
||||||
|
/*
|
||||||
|
* HACK: if there's a non-zero directed component, this
|
||||||
|
* lightgrid cell is useful. However, q3 skips grid
|
||||||
|
* cells with zero ambient. So let's force ambient to be
|
||||||
|
* nonzero unless directed is zero too.
|
||||||
|
*/
|
||||||
|
if( bgp->ambient[i][0] + bgp->ambient[i][1] + bgp->ambient[i][2] == 0
|
||||||
|
&& bgp->directed[i][0] + bgp->directed[i][1] + bgp->directed[i][2] != 0 )
|
||||||
|
VectorSet( bgp->ambient[i], 1, 1, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* debug code */
|
/* debug code */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user