diff options
author | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-11-04 22:32:00 +0000 |
---|---|---|
committer | tma <tma@edf5b092-35ff-0310-97b2-ce42778d08ea> | 2005-11-04 22:32:00 +0000 |
commit | 11e5099eb7abb2e016527795ffd32c5094e5324f (patch) | |
tree | 3de0470c8544b681df252ad1c5e3724320b54d9c /code/qcommon/q_math.c | |
parent | 657f95c6a5d8a24df0c1a206eb32f54985c7b4fe (diff) | |
download | ioquake3-aero-11e5099eb7abb2e016527795ffd32c5094e5324f.tar.gz ioquake3-aero-11e5099eb7abb2e016527795ffd32c5094e5324f.zip |
* Replaced a bunch of inline and __inline with ID_INLINE
* Replaced a bunch of __i386__ with id386
* General tidy up of asm preprocessor decisions
* Removed C_ONLY from the dedicated server build
git-svn-id: svn://svn.icculus.org/quake3/trunk@269 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon/q_math.c')
-rw-r--r-- | code/qcommon/q_math.c | 74 |
1 files changed, 11 insertions, 63 deletions
diff --git a/code/qcommon/q_math.c b/code/qcommon/q_math.c index da3044e..de90b8b 100644 --- a/code/qcommon/q_math.c +++ b/code/qcommon/q_math.c @@ -21,8 +21,15 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // // q_math.c -- stateless support routines that are included in each code module -#include "q_shared.h" +// Some of the vector functions are static inline in q_shared.h. q3asm +// doesn't understand static functions though, so we only want them in +// one file. That's what this is about. +#ifdef Q3_VM +#define __Q3_VM_MATH +#endif + +#include "q_shared.h" vec3_t vec3_origin = {0,0,0}; vec3_t axisDefault[3] = { { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }; @@ -153,63 +160,6 @@ float Q_crandom( int *seed ) { return 2.0 * ( Q_random( seed ) - 0.5 ); } -#ifdef Q3_VM - -int VectorCompare( const vec3_t v1, const vec3_t v2 ) { - if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) { - return 0; - } - return 1; -} - -vec_t VectorLength( const vec3_t v ) { - return (vec_t)sqrt (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); -} - -vec_t VectorLengthSquared( const vec3_t v ) { - return (v[0]*v[0] + v[1]*v[1] + v[2]*v[2]); -} - -vec_t Distance( const vec3_t p1, const vec3_t p2 ) { - vec3_t v; - - VectorSubtract (p2, p1, v); - return VectorLength( v ); -} - -vec_t DistanceSquared( const vec3_t p1, const vec3_t p2 ) { - vec3_t v; - - VectorSubtract (p2, p1, v); - return v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; -} - -// fast vector normalize routine that does not check to make sure -// that length != 0, nor does it return length, uses rsqrt approximation -void VectorNormalizeFast( vec3_t v ) -{ - float ilength; - - ilength = Q_rsqrt( DotProduct( v, v ) ); - - v[0] *= ilength; - v[1] *= ilength; - v[2] *= ilength; -} - -void VectorInverse( vec3_t v ){ - v[0] = -v[0]; - v[1] = -v[1]; - v[2] = -v[2]; -} - -void CrossProduct( const vec3_t v1, const vec3_t v2, vec3_t cross ) { - cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; - cross[1] = v1[2]*v2[0] - v1[0]*v2[2]; - cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; -} -#endif - //======================================================= signed char ClampChar( int i ) { @@ -736,10 +686,7 @@ int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p) ================== */ -// if not GNU x86 and configured to use asm -#if !( (defined __GNUC__) && (defined __i386__) && (!defined C_ONLY)) - -#if defined Q3_VM || defined C_ONLY || !id386 || defined __VECTORC +#if !id386 int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p) { @@ -804,6 +751,8 @@ int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p) return sides; } +#elif __GNUC__ +// use matha.s #else #pragma warning( disable: 4035 ) @@ -1039,7 +988,6 @@ Lerror: #pragma warning( default: 4035 ) #endif -#endif /* ================= |