From 2afef413c01dfc2640625790a1d020b2158569f0 Mon Sep 17 00:00:00 2001 From: Garux Date: Sat, 16 Nov 2024 05:52:52 +0500 Subject: [PATCH] fix floating point errors --- tools/quake3/q3map2/light_ydnar.cpp | 4 ++-- tools/quake3/q3map2/surface_meta.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/quake3/q3map2/light_ydnar.cpp b/tools/quake3/q3map2/light_ydnar.cpp index ecb259ef..bdf5a6b2 100644 --- a/tools/quake3/q3map2/light_ydnar.cpp +++ b/tools/quake3/q3map2/light_ydnar.cpp @@ -3061,13 +3061,13 @@ void IlluminateVertexes( int num ){ { /* clear vertex luxel */ radVertLuxel.set( -1.0f ); - + /* setup trace */ + trace.normal = verts[ i ].normal; /* try at initial origin */ trace.cluster = ClusterForPointExtFilter( verts[ i ].xyz, VERTEX_EPSILON, info->numSurfaceClusters, &surfaceClusters[ info->firstSurfaceCluster ] ); if ( trace.cluster >= 0 ) { /* setup trace */ trace.origin = verts[ i ].xyz; - trace.normal = verts[ i ].normal; /* r7 dirt */ if ( dirty && !bouncing ) { diff --git a/tools/quake3/q3map2/surface_meta.cpp b/tools/quake3/q3map2/surface_meta.cpp index 94232a4d..bc53c199 100644 --- a/tools/quake3/q3map2/surface_meta.cpp +++ b/tools/quake3/q3map2/surface_meta.cpp @@ -1444,7 +1444,7 @@ static int AddMetaTriangleToSurface( mapDrawSurface_t *ds, const metaTriangle_t& newTexMinMax.extend( Vector3( tri.m_vertices[ 0 ]->st ) ); newTexMinMax.extend( Vector3( tri.m_vertices[ 1 ]->st ) ); newTexMinMax.extend( Vector3( tri.m_vertices[ 2 ]->st ) ); - if( texMinMax.surrounds( newTexMinMax ) ){ + if( numVerts_original == 0 || texMinMax.surrounds( newTexMinMax ) ){ score += 4 * ST_SCORE; } else{