From 3ff224cbdfc7c34c7233d3dcbcb49cd3154dc9ad Mon Sep 17 00:00:00 2001 From: Garux Date: Mon, 25 Jan 2021 08:36:16 +0300 Subject: [PATCH] fix texture projection decompilation in C this check was equal to abs((int)dist) >= distanceEpsilon comparing float dist to distanceEpsilon is not sufficient, as points are not precise enough, plus they are snapped --- tools/quake3/q3map2/convert_map.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/quake3/q3map2/convert_map.cpp b/tools/quake3/q3map2/convert_map.cpp index c6a5f4e1..ee730f8b 100644 --- a/tools/quake3/q3map2/convert_map.cpp +++ b/tools/quake3/q3map2/convert_map.cpp @@ -111,13 +111,14 @@ void GetBestSurfaceTriangleMatchForBrushside( side_t *buildSide, bspDrawVert_t * continue; } } - if ( abs( DotProduct( vert[0]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) { + // fixme? better distance epsilon + if ( abs( DotProduct( vert[0]->xyz, buildPlane->normal ) - buildPlane->dist ) > 1 ) { continue; } - if ( abs( DotProduct( vert[1]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) { + if ( abs( DotProduct( vert[1]->xyz, buildPlane->normal ) - buildPlane->dist ) > 1 ) { continue; } - if ( abs( DotProduct( vert[2]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) { + if ( abs( DotProduct( vert[2]->xyz, buildPlane->normal ) - buildPlane->dist ) > 1 ) { continue; } // Okay. Correct surface type, correct shader, correct plane. Let's start with the business...