From: Rudolf Polzer Date: Tue, 18 Oct 2011 15:07:24 +0000 (+0200) Subject: alphashadow/lightfilter: bound the texcoords after converting to integer to guard... X-Git-Tag: xonotic-v0.6.0~63 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d67672d1b3a9c8e0e3408c74f18c413af087af6b;p=xonotic%2Fnetradiant.git alphashadow/lightfilter: bound the texcoords after converting to integer to guard against float accuracy issues --- 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);