mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2025-01-17 14:47:19 +01:00
Hook up SDL_acos and SDL_asin properly.
This commit is contained in:
parent
5e656f8950
commit
d01ad02be7
@ -473,8 +473,8 @@ if(LIBC)
|
|||||||
malloc calloc realloc free qsort abs memset memcpy memmove memcmp
|
malloc calloc realloc free qsort abs memset memcpy memmove memcmp
|
||||||
strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
|
strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa
|
||||||
_ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
|
_ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp
|
||||||
_stricmp _strnicmp sscanf atan atan2 ceil copysign cos cosf fabs
|
_stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos
|
||||||
floor log pow scalbn sin sinf sqrt)
|
cosf fabs floor log pow scalbn sin sinf sqrt)
|
||||||
string(TOUPPER ${_FN} _UPPER)
|
string(TOUPPER ${_FN} _UPPER)
|
||||||
set(HAVE_${_UPPER} 1)
|
set(HAVE_${_UPPER} 1)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
2
configure
vendored
2
configure
vendored
@ -16628,7 +16628,7 @@ if test "x$ac_cv_lib_m_pow" = xyes; then :
|
|||||||
LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"
|
LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for ac_func in atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt
|
for ac_func in atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt
|
||||||
do :
|
do :
|
||||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||||
|
@ -271,7 +271,7 @@ if test x$enable_libc = xyes; then
|
|||||||
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname)
|
AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp sscanf snprintf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname)
|
||||||
|
|
||||||
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
|
AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
|
||||||
AC_CHECK_FUNCS(atan atan2 ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
|
AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
|
||||||
|
|
||||||
AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
|
AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
|
||||||
AC_CHECK_FUNCS(iconv)
|
AC_CHECK_FUNCS(iconv)
|
||||||
|
@ -130,6 +130,8 @@
|
|||||||
#cmakedefine HAVE_M_PI 1
|
#cmakedefine HAVE_M_PI 1
|
||||||
#cmakedefine HAVE_ATAN 1
|
#cmakedefine HAVE_ATAN 1
|
||||||
#cmakedefine HAVE_ATAN2 1
|
#cmakedefine HAVE_ATAN2 1
|
||||||
|
#cmakedefine HAVE_ACOS 1
|
||||||
|
#cmakedefine HAVE_ASIN 1
|
||||||
#cmakedefine HAVE_CEIL 1
|
#cmakedefine HAVE_CEIL 1
|
||||||
#cmakedefine HAVE_COPYSIGN 1
|
#cmakedefine HAVE_COPYSIGN 1
|
||||||
#cmakedefine HAVE_COS 1
|
#cmakedefine HAVE_COS 1
|
||||||
|
@ -133,6 +133,8 @@
|
|||||||
#undef HAVE_M_PI
|
#undef HAVE_M_PI
|
||||||
#undef HAVE_ATAN
|
#undef HAVE_ATAN
|
||||||
#undef HAVE_ATAN2
|
#undef HAVE_ATAN2
|
||||||
|
#undef HAVE_ACOS
|
||||||
|
#undef HAVE_ASIN
|
||||||
#undef HAVE_CEIL
|
#undef HAVE_CEIL
|
||||||
#undef HAVE_COPYSIGN
|
#undef HAVE_COPYSIGN
|
||||||
#undef HAVE_COS
|
#undef HAVE_COS
|
||||||
|
@ -87,6 +87,8 @@
|
|||||||
#define HAVE_M_PI 1
|
#define HAVE_M_PI 1
|
||||||
#define HAVE_ATAN 1
|
#define HAVE_ATAN 1
|
||||||
#define HAVE_ATAN2 1
|
#define HAVE_ATAN2 1
|
||||||
|
#define HAVE_ACOS 1
|
||||||
|
#define HAVE_ASIN 1
|
||||||
#define HAVE_CEIL 1
|
#define HAVE_CEIL 1
|
||||||
#define HAVE_COPYSIGN 1
|
#define HAVE_COPYSIGN 1
|
||||||
#define HAVE_COS 1
|
#define HAVE_COS 1
|
||||||
|
@ -85,6 +85,8 @@
|
|||||||
#define HAVE_M_PI 1
|
#define HAVE_M_PI 1
|
||||||
#define HAVE_ATAN 1
|
#define HAVE_ATAN 1
|
||||||
#define HAVE_ATAN2 1
|
#define HAVE_ATAN2 1
|
||||||
|
#define HAVE_ACOS 1
|
||||||
|
#define HAVE_ASIN 1
|
||||||
#define HAVE_CEIL 1
|
#define HAVE_CEIL 1
|
||||||
#define HAVE_COPYSIGN 1
|
#define HAVE_COPYSIGN 1
|
||||||
#define HAVE_COS 1
|
#define HAVE_COS 1
|
||||||
|
@ -104,6 +104,8 @@
|
|||||||
#define HAVE_SYSCTLBYNAME 1
|
#define HAVE_SYSCTLBYNAME 1
|
||||||
#define HAVE_ATAN 1
|
#define HAVE_ATAN 1
|
||||||
#define HAVE_ATAN2 1
|
#define HAVE_ATAN2 1
|
||||||
|
#define HAVE_ACOS 1
|
||||||
|
#define HAVE_ASIN 1
|
||||||
|
|
||||||
/* Enable various audio drivers */
|
/* Enable various audio drivers */
|
||||||
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
#define SDL_AUDIO_DRIVER_COREAUDIO 1
|
||||||
|
@ -85,6 +85,8 @@
|
|||||||
#define HAVE_M_PI 1
|
#define HAVE_M_PI 1
|
||||||
#define HAVE_ATAN 1
|
#define HAVE_ATAN 1
|
||||||
#define HAVE_ATAN2 1
|
#define HAVE_ATAN2 1
|
||||||
|
#define HAVE_ACOS 1
|
||||||
|
#define HAVE_ASIN 1
|
||||||
#define HAVE_CEIL 1
|
#define HAVE_CEIL 1
|
||||||
#define HAVE_COPYSIGN 1
|
#define HAVE_COPYSIGN 1
|
||||||
#define HAVE_COS 1
|
#define HAVE_COS 1
|
||||||
|
@ -118,6 +118,8 @@ typedef unsigned int uintptr_t;
|
|||||||
#define HAVE__STRNICMP 1
|
#define HAVE__STRNICMP 1
|
||||||
#define HAVE_ATAN 1
|
#define HAVE_ATAN 1
|
||||||
#define HAVE_ATAN2 1
|
#define HAVE_ATAN2 1
|
||||||
|
#define HAVE_ACOS 1
|
||||||
|
#define HAVE_ASIN 1
|
||||||
#define HAVE_CEIL 1
|
#define HAVE_CEIL 1
|
||||||
#define HAVE_COS 1
|
#define HAVE_COS 1
|
||||||
#define HAVE_COSF 1
|
#define HAVE_COSF 1
|
||||||
|
@ -113,28 +113,3 @@ double atan(double x)
|
|||||||
}
|
}
|
||||||
libm_hidden_def(atan)
|
libm_hidden_def(atan)
|
||||||
|
|
||||||
double SDL_acos(double val)
|
|
||||||
{
|
|
||||||
double result;
|
|
||||||
if (val == -1.0) {
|
|
||||||
result = M_PI;
|
|
||||||
} else {
|
|
||||||
result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
|
|
||||||
if (result < 0.0)
|
|
||||||
{
|
|
||||||
result += M_PI;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
double SDL_asin(double val)
|
|
||||||
{
|
|
||||||
double result;
|
|
||||||
if (val == -1.0) {
|
|
||||||
result = -(M_PI / 2.0);
|
|
||||||
} else {
|
|
||||||
result = (M_PI / 2.0) - SDL_acos(val);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
@ -46,6 +46,42 @@ SDL_atan2(double x, double y)
|
|||||||
#endif /* HAVE_ATAN2 */
|
#endif /* HAVE_ATAN2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
SDL_acos(double val)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_ACOS)
|
||||||
|
return acos(val);
|
||||||
|
#else
|
||||||
|
double result;
|
||||||
|
if (val == -1.0) {
|
||||||
|
result = M_PI;
|
||||||
|
} else {
|
||||||
|
result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
|
||||||
|
if (result < 0.0)
|
||||||
|
{
|
||||||
|
result += M_PI;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
double
|
||||||
|
SDL_asin(double val)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_ASIN)
|
||||||
|
return asin(val);
|
||||||
|
#else
|
||||||
|
double result;
|
||||||
|
if (val == -1.0) {
|
||||||
|
result = -(M_PI / 2.0);
|
||||||
|
} else {
|
||||||
|
result = (M_PI / 2.0) - SDL_acos(val);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
SDL_ceil(double x)
|
SDL_ceil(double x)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user