Re: [Plib-users] culling problems w/ off-axis projection
Brought to you by:
sjbaker
From: Melchior F. <mel...@gm...> - 2010-05-31 14:12:08
|
Sending again, because I used the wrong email address. Twice! Sigh. * John F. Fay -- Monday 31 May 2010: > It uses the functions "_isnan" and "_isfinite" which are just > fine on my Windows/MSVC platform. For some reason MICROS~1 is in love with these underscore functions, which are, in the real world, just isnan() and isfinite(). So this doesn't compile on Linux: sg.cxx: In function ‘void sgQuatToAngleAxis(float*, float*, const float*)’: sg.cxx:1311: error: ‘_isnan’ was not declared in this scope sg.cxx:1311: error: ‘_finite’ was not declared in this scope I suggest to do something like this: diff --git a/src/sg/sg.cxx b/src/sg/sg.cxx index 0e182fb..b6aa05c 100644 --- a/src/sg/sg.cxx +++ b/src/sg/sg.cxx @@ -24,6 +24,12 @@ #include "sg.h" +#ifdef UL_WIN32 +# define isnan _isnan +# define finite _finite +#endif + + sgVec3 _sgGravity = { 0.0f, 0.0f, -9.8f } ; void sgVectorProductVec3 ( sgVec3 dst, const sgVec3 a, const sgVec3 b ) @@ -1308,7 +1314,7 @@ void sgQuatToAngleAxis ( SGfloat *angle, void sgQuatToAngleAxis ( SGfloat *angle, sgVec3 axis, const sgQuat src ) { SGfloat a = (SGfloat) acos ( src[SG_W] ) ; - if ( _isnan(a) || !_finite(a) ) { + if ( isnan(a) || !finite(a) ) { ulSetError(UL_WARNING,"sgQuatToAngleAxis: acos(%f) %f",src[SG_W],a); if ( src[SG_W] >= 1 ) a = 0; else if ( src[SG_W] <= -1 ) a = SG_PI; m. |