00001 #ifndef _MERCURYMATH_H
00002 #define _MERCURYMATH_H
00003
00004 #include <math.h>
00005
00006 #define DEGRAD 0.01745329251994329576f //degree to radian
00007 #define RADDEG 57.2957795130823208767f //radian to degree
00008 #define Q_PI 3.14159265358979323846f
00009
00010 #if defined(WIN32)
00011
00012 #define SIN( x ) float( sin ( x ) )
00013 #define COS( x ) float( cos ( x ) )
00014 #define ATAN2( x, y ) float( atan2( x, y ) )
00015 #define ASIN( x ) float( asin ( x ) )
00016 #define ACOS( x ) float( acos ( x ) )
00017 #define SQRT( x ) float( sqrt ( x ) )
00018 #define TAN( x ) float( tan ( x ) )
00019 #define ABS( x ) float( ((x<0)?(-x):(x)) )
00020 #else
00021
00022 #define SIN( x ) sinf( x )
00023 #define COS( x ) cosf( x )
00024 #define ATAN2( x, y ) atan2f( x, y )
00025 #define ASIN( x ) asinf ( x )
00026 #define ACOS( x ) acosf ( x )
00027 #define SQRT( x ) sqrtf( x )
00028 #define TAN( x ) tanf( x )
00029 #define ABS( x ) ((x<0)?(-x):(x))
00030 #endif
00031
00032 #define SQ(x) ((x)*(x));
00033
00034 #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
00035
00036 #if !defined( _MSC_VER ) || defined( SLOW_CODE )
00037
00038 void Mul4f(const float* first, const float* second, float* out);
00039 void Div4f(const float* first, const float* second, float* out);
00040 void Add4f(const float* first, const float* second, float* out);
00041 void Sub4f(const float* first, const float* second, float* out);
00042 void Copy4f( void * dest, const void * source );
00043 void Copy8f( void * dest, const void * source );
00044 void Copy16f( void * dest, const void * source );
00045 void R_ConcatTransforms4 ( const float* in1, const float* in2, float* out );
00046 #else
00047
00048 extern "C" void Mul4f(const float* first, const float* second, float* out);
00049 extern "C" void Div4f(const float* first, const float* second, float* out);
00050 extern "C" void Add4f(const float* first, const float* second, float* out);
00051 extern "C" void Sub4f(const float* first, const float* second, float* out);
00052 extern "C" void __fastcall Copy4f( void * dest, const void * source );
00053 extern "C" void __fastcall Copy8f( void * dest, const void * source );
00054 extern "C" void __fastcall Copy16f( void * dest, const void * source );
00055 extern "C" void R_ConcatTransforms4 ( const float* in1, const float* in2, float* out );
00056 #endif
00057
00058 void VectorMultiply4f(const float *m, float *p, float *out );
00059
00060 #endif
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086