From 8dab7339d9fc0ceac137e8c57daa22bf40e9c138 Mon Sep 17 00:00:00 2001 From: Garux Date: Sat, 7 Sep 2019 20:55:55 +0300 Subject: [PATCH] rephrase -trianglecheck and -extravisnudge code --- tools/quake3/q3map2/light_ydnar.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tools/quake3/q3map2/light_ydnar.c b/tools/quake3/q3map2/light_ydnar.c index 3234d14c..2f351e89 100644 --- a/tools/quake3/q3map2/light_ydnar.c +++ b/tools/quake3/q3map2/light_ydnar.c @@ -446,7 +446,6 @@ static int MapSingleLuxel( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t vec4_t sideplane, hostplane; vec3_t origintwo; int j, next; - float e; float *nudge; static float nudges[][ 2 ] = { @@ -571,15 +570,11 @@ static int MapSingleLuxel( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t PlaneFromPoints( sideplane,cverts[i],cverts[ next ], temp ); //planetest sample point - e = DotProduct( origin,sideplane ); - e = e - sideplane[3]; - if ( e > 0 ) { + const float e = DotProduct( origin, sideplane ) - sideplane[3]; + if ( e > -LUXEL_EPSILON ) { //we're bad. - //VectorClear(origin); //Move the sample point back inside triangle bounds - origin[0] -= sideplane[0] * ( e + 1 ); - origin[1] -= sideplane[1] * ( e + 1 ); - origin[2] -= sideplane[2] * ( e + 1 ); + VectorMA( origin, ( -e - 1 ), sideplane, origin ); #ifdef DEBUG_27_1 VectorClear( origin ); #endif @@ -628,9 +623,7 @@ static int MapSingleLuxel( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t VectorCopy( origin,origintwo ); if ( lightmapExtraVisClusterNudge ) { - origintwo[0] += vecs[2][0]; - origintwo[1] += vecs[2][1]; - origintwo[2] += vecs[2][2]; + VectorAdd( origintwo, vecs[2], origintwo ); } /* get cluster */