From b2bc2077e5624b20d90565ee2f9564ce74f39c4d Mon Sep 17 00:00:00 2001 From: Garux Date: Tue, 5 Jan 2021 01:34:55 +0300 Subject: [PATCH] prevent division by zero, which spreads darkness during bounces source of the problem is located somewhere else --- tools/quake3/q3map2/light_ydnar.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/quake3/q3map2/light_ydnar.c b/tools/quake3/q3map2/light_ydnar.c index 1ded2a24..a9914f74 100644 --- a/tools/quake3/q3map2/light_ydnar.c +++ b/tools/quake3/q3map2/light_ydnar.c @@ -792,6 +792,12 @@ static bool MapTriangle( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t * return false; } + /* this must not happen in the first place, but it does and spreads result of division by zero in MapSingleLuxel all over the map during -bounce */ + if( lm->vecs != NULL && plane[lm->axisNum] == 0 ){ + Sys_Warning( "plane[lm->axisNum] == 0\n" ); + return false; + } + /* check to see if we need to calculate texture->world tangent vectors */ if ( info->si->normalImage != NULL && CalcTangentVectors( 3, dv, stvStatic, ttvStatic ) ) { stv = stvStatic;