From d67672d1b3a9c8e0e3408c74f18c413af087af6b Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 18 Oct 2011 17:07:24 +0200 Subject: [PATCH 1/1] alphashadow/lightfilter: bound the texcoords after converting to integer to guard against float accuracy issues --- tools/quake3/q3map2/light_trace.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/quake3/q3map2/light_trace.c b/tools/quake3/q3map2/light_trace.c index 84e4ab0e..a328f466 100644 --- a/tools/quake3/q3map2/light_trace.c +++ b/tools/quake3/q3map2/light_trace.c @@ -1498,6 +1498,10 @@ qboolean TraceTriangle( traceInfo_t *ti, traceTriangle_t *tt, trace_t *trace ) t = t - floor( t ); is = s * si->lightImage->width; it = t * si->lightImage->height; + if(is < 0) is = 0; + if(is > si->lightImage->width - 1) is = si->lightImage->width - 1; + if(it < 0) it = 0; + if(it > si->lightImage->height - 1) it = si->lightImage->height - 1; /* get pixel */ pixel = si->lightImage->pixels + 4 * (it * si->lightImage->width + is); -- 2.39.2