Use acosf when available

This commit is contained in:
Chris Robinson
2008-01-15 21:23:14 -08:00
parent bf87aed459
commit abc69dd3d0
3 changed files with 13 additions and 2 deletions
+8 -1
View File
@@ -49,6 +49,12 @@ typedef long long ALint64;
#define aluSqrt(x) ((ALfloat)sqrt((double)(x)))
#endif
#ifdef HAVE_ACOSF
#define aluAcos(x) ((ALfloat)acosf((float)(x)))
#else
#define aluAcos(x) ((ALfloat)acos((double)(x)))
#endif
// fixes for mingw32.
#if defined(max) && !defined(__max)
#define __max max
@@ -390,7 +396,8 @@ static ALvoid CalcSourceParams(ALCcontext *ALContext, ALsource *ALSource,
SourceToListener[2] = -Position[2];
aluNormalize(Direction);
aluNormalize(SourceToListener);
Angle = (ALfloat)(180.0*acos(aluDotproduct(Direction,SourceToListener))/3.141592654f);
Angle = aluAcos(aluDotproduct(Direction,SourceToListener)) * 180.0f /
3.141592654f;
if(Angle >= InnerAngle && Angle <= OuterAngle)
{
ALfloat scale = (Angle-InnerAngle) / (OuterAngle-InnerAngle);
+2 -1
View File
@@ -101,7 +101,8 @@ ENDIF()
CHECK_LIBRARY_EXISTS(m sqrtf "" HAVE_SQRTF)
IF(HAVE_SQRTF)
CHECK_LIBRARY_EXISTS(m acosf "" HAVE_ACOSF)
IF(HAVE_SQRTF OR HAVE_ACOSF)
SET(EXTRA_LIBS m ${EXTRA_LIBS})
ENDIF()
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
+3
View File
@@ -19,6 +19,9 @@
/* Define if we have the sqrtf function */
#cmakedefine HAVE_SQRTF
/* Define if we have the acosf function */
#cmakedefine HAVE_ACOSF
/* Define if we have the strtof function */
#cmakedefine HAVE_STRTOF