Remove makros and add undefs to avoid clashing names
FRAND and Clamp were not used and Clamp collided when doing unit builds. SQUARE(x) is longer than x*x and if x is an expression it gets evaluated twice.
This commit is contained in:
@@ -44,6 +44,17 @@ typedef WPARAM LocalKeySym;
|
|||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
typedef KeySym LocalKeySym;
|
typedef KeySym LocalKeySym;
|
||||||
#define LOCAL_KEY_NONE XK_VoidSymbol
|
#define LOCAL_KEY_NONE XK_VoidSymbol
|
||||||
|
#undef Status
|
||||||
|
#undef Bool
|
||||||
|
#undef None
|
||||||
|
#undef CursorShape
|
||||||
|
#undef KeyPress
|
||||||
|
#undef KeyRelease
|
||||||
|
#undef FocusIn
|
||||||
|
#undef FocusOut
|
||||||
|
#undef FontChange
|
||||||
|
#undef Unsorted
|
||||||
|
#undef GrayScale
|
||||||
|
|
||||||
#elif defined(ANDROID) // This is temporary until we understand how to send real key events from Java
|
#elif defined(ANDROID) // This is temporary until we understand how to send real key events from Java
|
||||||
typedef long unsigned int LocalKeySym;
|
typedef long unsigned int LocalKeySym;
|
||||||
|
|||||||
@@ -3,15 +3,6 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
/*************************** Macros and constants ***************************/
|
|
||||||
// returns a number ranging from -1.0 to 1.0
|
|
||||||
#define FRAND (((float)rand()-(float)rand())/RAND_MAX)
|
|
||||||
#define Clamp(x, min, max) x = (x<min ? min : x<max ? x : max);
|
|
||||||
|
|
||||||
#define SQUARE(x) (x)*(x)
|
|
||||||
|
|
||||||
|
|
||||||
struct Vector3D
|
struct Vector3D
|
||||||
{
|
{
|
||||||
Vector3D(float x, float y, float z) : x(x), y(y), z(z) {}
|
Vector3D(float x, float y, float z) : x(x), y(y), z(z) {}
|
||||||
@@ -63,7 +54,7 @@ struct Vector3D
|
|||||||
|
|
||||||
float Length()
|
float Length()
|
||||||
{
|
{
|
||||||
float length = (float)sqrt(SQUARE(x) + SQUARE(y) + SQUARE(z));
|
float length = sqrt(x*x + y*y + z*z);
|
||||||
return (length != 0.0f) ? length : 1.0f;
|
return (length != 0.0f) ? length : 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user