From 5ee552ea5ba69b945a2e34c034b0bd4a51dddf2f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 27 Nov 2011 17:41:32 +0900 Subject: [PATCH] Don't normalize the portal edge vectors. This simplifies the collision handling code. --- include/QF/winding.h | 5 +++-- libs/models/portal.c | 2 +- libs/models/winding.c | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/QF/winding.h b/include/QF/winding.h index 0696aa678..a467b2daa 100644 --- a/include/QF/winding.h +++ b/include/QF/winding.h @@ -90,10 +90,11 @@ winding_t *CopyWindingReverse (const winding_t *w); given winding. \param w The winding to convert. - \return The "winding" holding the unit vectors. + \param unit If true, normalize the vectors. + \return The "winding" holding the (unit) vectors. \note It is the caller's responsibiltiy to free the new winding. */ -winding_t *WindingVectors (const winding_t *w); +winding_t *WindingVectors (const winding_t *w, int unit); /** Clip the winding to the plain. diff --git a/libs/models/portal.c b/libs/models/portal.c index f6d312ff9..d7170b0d1 100644 --- a/libs/models/portal.c +++ b/libs/models/portal.c @@ -189,7 +189,7 @@ MOD_BuildBrushes (hull_t *hull) side = p->leafs[1] == leaf; if (p->edges) continue; - p->edges = WindingVectors (p->winding); + p->edges = WindingVectors (p->winding, 0); } } } diff --git a/libs/models/winding.c b/libs/models/winding.c index e75be9731..455707a36 100644 --- a/libs/models/winding.c +++ b/libs/models/winding.c @@ -141,7 +141,7 @@ CopyWindingReverse (const winding_t *w) } winding_t * -WindingVectors (const winding_t *w) +WindingVectors (const winding_t *w, int unit) { int i; size_t size; @@ -153,7 +153,8 @@ WindingVectors (const winding_t *w) for (i = 0; i < w->numpoints; i++) { VectorSubtract (w->points[(i + 1) % w->numpoints], w->points[i], c->points[i]); - VectorNormalize (c->points[i]); + if (unit) + VectorNormalize (c->points[i]); } return c; }