From: Rudolf Polzer Date: Fri, 16 Jul 2010 10:51:56 +0000 (+0200) Subject: fix a nasty bug breaking "deformvertexes move" X-Git-Tag: xonotic-v0.5.0~249 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dab02ced761a4eb5bc750340b737fc1e58a5333d;p=xonotic%2Fnetradiant.git fix a nasty bug breaking "deformvertexes move" --- diff --git a/tools/quake3/q3map2/surface.c b/tools/quake3/q3map2/surface.c index f17f7c3e..7f511b93 100644 --- a/tools/quake3/q3map2/surface.c +++ b/tools/quake3/q3map2/surface.c @@ -2037,14 +2037,25 @@ int FilterWindingIntoTree_r( winding_t *w, mapDrawSurface_t *ds, node_t *node ) { /* 'fatten' the winding by the shader mins/maxs (parsed from vertexDeform move) */ /* note this winding is completely invalid (concave, nonplanar, etc) */ - fat = AllocWinding( w->numpoints * 3 ); - fat->numpoints = w->numpoints * 3; + fat = AllocWinding( w->numpoints * 3 + 3 ); + fat->numpoints = w->numpoints * 3 + 3; for( i = 0; i < w->numpoints; i++ ) { VectorCopy( w->p[ i ], fat->p[ i ] ); - VectorAdd( w->p[ i ], si->mins, fat->p[ i * 2 ] ); - VectorAdd( w->p[ i ], si->maxs, fat->p[ i * 3 ] ); + VectorAdd( w->p[ i ], si->mins, fat->p[ i + (w->numpoints+1) ] ); + VectorAdd( w->p[ i ], si->maxs, fat->p[ i + (w->numpoints+1) * 2 ] ); } + VectorCopy( w->p[ 0 ], fat->p[ i ] ); + VectorAdd( w->p[ 0 ], si->mins, fat->p[ i + w->numpoints ] ); + VectorAdd( w->p[ 0 ], si->maxs, fat->p[ i + w->numpoints * 2 ] ); + + /* + * note: this winding is STILL not suitable for ClipWindingEpsilon, and + * also does not really fulfill the intention as it only contains + * origin, +mins, +maxs, but thanks to the "closing" points I just + * added to the three sub-windings, the fattening at least doesn't make + * it worse + */ FreeWinding( w ); w = fat;