diff options
author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2007-10-06 21:59:17 +0000 |
---|---|---|
committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2007-10-06 21:59:17 +0000 |
commit | aeaae017e0ca84f74fb3877744d1cf575f83773c (patch) | |
tree | a93fc46f08b18dfa080883b1219f883d8b811a46 /code | |
parent | 6bf8f279665d5d006159fb9fc180984c644ed875 (diff) | |
download | ioquake3-aero-aeaae017e0ca84f74fb3877744d1cf575f83773c.tar.gz ioquake3-aero-aeaae017e0ca84f74fb3877744d1cf575f83773c.zip |
* Bug fix to collision optimisation (arQon)
git-svn-id: svn://svn.icculus.org/quake3/trunk@1190 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code')
-rw-r--r-- | code/qcommon/cm_local.h | 2 | ||||
-rw-r--r-- | code/qcommon/cm_patch.c | 2 | ||||
-rw-r--r-- | code/qcommon/cm_test.c | 41 | ||||
-rw-r--r-- | code/qcommon/cm_trace.c | 2 |
4 files changed, 44 insertions, 3 deletions
diff --git a/code/qcommon/cm_local.h b/code/qcommon/cm_local.h index 46dff4b..5848fdc 100644 --- a/code/qcommon/cm_local.h +++ b/code/qcommon/cm_local.h @@ -185,6 +185,8 @@ void CM_StoreBrushes( leafList_t *ll, int nodenum ); void CM_BoxLeafnums_r( leafList_t *ll, int nodenum ); cmodel_t *CM_ClipHandleToModel( clipHandle_t handle ); +qboolean CM_BoundsIntersect( const vec3_t mins, const vec3_t maxs, const vec3_t mins2, const vec3_t maxs2 ); +qboolean CM_BoundsIntersectPoint( const vec3_t mins, const vec3_t maxs, const vec3_t point ); // cm_patch.c diff --git a/code/qcommon/cm_patch.c b/code/qcommon/cm_patch.c index 176aac1..77cf368 100644 --- a/code/qcommon/cm_patch.c +++ b/code/qcommon/cm_patch.c @@ -1386,7 +1386,7 @@ void CM_TraceThroughPatchCollide( traceWork_t *tw, const struct patchCollide_s * static cvar_t *cv; #endif //BSPC - if ( !BoundsIntersect( tw->bounds[0], tw->bounds[1], + if ( !CM_BoundsIntersect( tw->bounds[0], tw->bounds[1], pc->bounds[0], pc->bounds[1] ) ) { return; } diff --git a/code/qcommon/cm_test.c b/code/qcommon/cm_test.c index 5aee7ee..9fd1ec5 100644 --- a/code/qcommon/cm_test.c +++ b/code/qcommon/cm_test.c @@ -250,7 +250,7 @@ int CM_PointContents( const vec3_t p, clipHandle_t model ) { brushnum = cm.leafbrushes[leaf->firstLeafBrush+k]; b = &cm.brushes[brushnum]; - if ( !BoundsIntersectPoint( b->bounds[0], b->bounds[1], p ) ) { + if ( !CM_BoundsIntersectPoint( b->bounds[0], b->bounds[1], p ) ) { continue; } @@ -480,3 +480,42 @@ int CM_WriteAreaBits (byte *buffer, int area) return bytes; } +/* +==================== +CM_BoundsIntersect +==================== +*/ +qboolean CM_BoundsIntersect( const vec3_t mins, const vec3_t maxs, const vec3_t mins2, const vec3_t maxs2 ) +{ + if (maxs[0] < mins2[0] - SURFACE_CLIP_EPSILON || + maxs[1] < mins2[1] - SURFACE_CLIP_EPSILON || + maxs[2] < mins2[2] - SURFACE_CLIP_EPSILON || + mins[0] > maxs2[0] + SURFACE_CLIP_EPSILON || + mins[1] > maxs2[1] + SURFACE_CLIP_EPSILON || + mins[2] > maxs2[2] + SURFACE_CLIP_EPSILON) + { + return qfalse; + } + + return qtrue; +} + +/* +==================== +CM_BoundsIntersectPoint +==================== +*/ +qboolean CM_BoundsIntersectPoint( const vec3_t mins, const vec3_t maxs, const vec3_t point ) +{ + if (maxs[0] < point[0] - SURFACE_CLIP_EPSILON || + maxs[1] < point[1] - SURFACE_CLIP_EPSILON || + maxs[2] < point[2] - SURFACE_CLIP_EPSILON || + mins[0] > point[0] + SURFACE_CLIP_EPSILON || + mins[1] > point[1] + SURFACE_CLIP_EPSILON || + mins[2] > point[2] + SURFACE_CLIP_EPSILON) + { + return qfalse; + } + + return qtrue; +} diff --git a/code/qcommon/cm_trace.c b/code/qcommon/cm_trace.c index a2873b1..bab7eed 100644 --- a/code/qcommon/cm_trace.c +++ b/code/qcommon/cm_trace.c @@ -685,7 +685,7 @@ void CM_TraceThroughLeaf( traceWork_t *tw, cLeaf_t *leaf ) { continue; } - if ( !BoundsIntersect( tw->bounds[0], tw->bounds[1], + if ( !CM_BoundsIntersect( tw->bounds[0], tw->bounds[1], b->bounds[0], b->bounds[1] ) ) { continue; } |