diff options
author | Tim Angus <tim@ngus.net> | 2007-11-03 00:06:23 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2007-11-03 00:06:23 +0000 |
commit | c6a9027b7cf0d35401cae346b67ca95c5f55b4a1 (patch) | |
tree | 3e41bfc88a8fb845cff921ccd62f5b3489fee703 /src/qcommon/cm_test.c | |
parent | 5c3429cb21861e253d9a80fa07f6487013c99109 (diff) |
* Merge ioq3-r1204
Diffstat (limited to 'src/qcommon/cm_test.c')
-rw-r--r-- | src/qcommon/cm_test.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/qcommon/cm_test.c b/src/qcommon/cm_test.c index 485facc2..420a91f2 100644 --- a/src/qcommon/cm_test.c +++ b/src/qcommon/cm_test.c @@ -251,7 +251,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; } @@ -481,3 +481,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; +} |