X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FQuaternions.h;h=00a374a733bf48788f2a4c96c8c1557406d847f5;hb=44146d06c780d3aaa283672fedb08b8870ebe1b9;hp=872500c9ddd8371d4f413515fc7a1eb685c7f2f9;hpb=0cca0c495c7dc29d134a10d7eed5de1f377c99bf;p=lugaru.git diff --git a/Source/Quaternions.h b/Source/Quaternions.h index 872500c..00a374a 100644 --- a/Source/Quaternions.h +++ b/Source/Quaternions.h @@ -1,3 +1,24 @@ +/* +Copyright (C) 2003, 2010 - Wolfire Games + +This file is part of Lugaru. + +Lugaru is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + #ifndef _QUATERNIONS_H_ #define _QUATERNIONS_H_ @@ -8,8 +29,8 @@ //#include "Carbon.h" #include "math.h" -#include "Physicsmath.h" -#include "gl.h" +#include "PhysicsMath.h" +#include "gamegl.h" /**> Quaternion Structures <**/ #define PI 3.14159265355555897932384626 @@ -37,6 +58,7 @@ public: float x; float y; float z; + XYZ() : x(0.0f), y(0.0f), z(0.0f) {} inline XYZ operator+(XYZ add); inline XYZ operator-(XYZ add); inline XYZ operator*(float add); @@ -207,9 +229,7 @@ inline void CrossProduct(XYZ P, XYZ Q, XYZ *V){ inline float fast_sqrt (register float arg) { -#ifdef WIN32 - return sqrtf( arg); -#else +#if PLATFORM_MACOSX // Can replace with slower return std::sqrt(arg); register float result; @@ -224,6 +244,8 @@ inline float fast_sqrt (register float arg) result = result + 0.5 * result * (1.0 - arg * result * result); return result * arg; +#else + return sqrtf( arg); #endif } @@ -463,4 +485,4 @@ inline bool DistancePointLine( XYZ *Point, XYZ *LineStart, XYZ *LineEnd, float * return 1; } -#endif \ No newline at end of file +#endif