X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=tools%2Fquake3%2Fq3map2%2Fmap.c;h=fabbcc8331485c85dd9ba85caa6742f6181b69c6;hb=6080bd2e589a86c3cae2b9b4d56dda2020a21452;hp=08d0a56899bf74c98c7319115220a353696b7c7f;hpb=7b688d9788aa791949a8859c2729bfabb0178b4e;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/q3map2/map.c b/tools/quake3/q3map2/map.c index 08d0a568..fabbcc83 100644 --- a/tools/quake3/q3map2/map.c +++ b/tools/quake3/q3map2/map.c @@ -69,7 +69,7 @@ qboolean PlaneEqual( plane_t *p, vec3_t normal, vec_t dist ){ /* compare */ // We check equality of each component since we're using '<', not '<=' - // (the epsilons may be zero). We want to use '<' intead of '<=' to be + // (the epsilons may be zero). We want to use '<' instead of '<=' to be // consistent with the true meaning of "epsilon", and also because other // parts of the code uses this inequality. if ( ( p->dist == dist || fabs( p->dist - dist ) < de ) && @@ -164,6 +164,44 @@ qboolean SnapNormal( vec3_t normal ){ // normalized). The original SnapNormal() didn't snap such vectors - it // only snapped vectors that were near a perfect axis. + //adjusting vectors, that were near a perfect axis, with bigger epsilon + //they cause precision errors + + /* + if ( ( normal[0] != 0.0 || normal[1] != 0.0 ) && fabs(normal[0]) < 0.00025 && fabs(normal[1]) < 0.00025){ + normal[0] = normal[1] = 0.0; + adjusted = qtrue; + } + else if ( ( normal[0] != 0.0 || normal[2] != 0.0 ) && fabs(normal[0]) < 0.00025 && fabs(normal[2]) < 0.00025){ + normal[0] = normal[2] = 0.0; + adjusted = qtrue; + } + else if ( ( normal[2] != 0.0 || normal[1] != 0.0 ) && fabs(normal[2]) < 0.00025 && fabs(normal[1]) < 0.00025){ + normal[2] = normal[1] = 0.0; + adjusted = qtrue; + } + */ + + /* + for ( i=0; i<30; i++ ) + { + double x, y, z, length; + x=(double) 1.0; + y=(double) ( 0.00001 * i ); + z=(double) 0.0; + + Sys_Printf("(%6.18f %6.18f %6.18f)inNormal\n", x,y,z ); + + length = sqrt( ( x * x ) + ( y * y ) + ( z * z ) ); + Sys_Printf("(%6.18f)length\n", length); + x = (vec_t) ( x / length ); + y = (vec_t) ( y / length ); + z = (vec_t) ( z / length ); + Sys_Printf("(%6.18f %6.18f %6.18f)outNormal\n\n", x,y,z ); + } + Error("vectorNormalize test completed"); + */ + for ( i = 0; i < 3; i++ ) { if ( normal[i] != 0.0 && -normalEpsilon < normal[i] && normal[i] < normalEpsilon ) { @@ -326,12 +364,7 @@ int FindFloatPlane( vec3_t innormal, vec_t dist, int numPoints, vec3_t *points ) VectorCopy( innormal, normal ); #if Q3MAP2_EXPERIMENTAL_SNAP_PLANE_FIX - if ( !doingModelClip ) { - SnapPlaneImproved( normal, &dist, numPoints, (const vec3_t *) points ); - } - if ( doingModelClip && snapModelClip ) { - SnapPlane( normal, &dist ); - } + SnapPlaneImproved( normal, &dist, numPoints, (const vec3_t *) points ); #else SnapPlane( normal, &dist ); #endif