convert PI to float to suppress warnings

This commit is contained in:
Recep Aslantas
2017-01-14 12:22:23 +02:00
parent 68657ec2cc
commit 170e2e9fcc
4 changed files with 12 additions and 8 deletions

View File

@@ -146,7 +146,7 @@ glm_perspective_default(mat4 dest) {
int32_t rect[4]; int32_t rect[4];
glm_platfom_get_viewport_rect(rect); glm_platfom_get_viewport_rect(rect);
glm_perspective((float)M_PI_4, glm_perspective((float)CGLM_PI_4,
(float)rect[2]/rect[3], (float)rect[2]/rect[3],
0.01f, 0.01f,
100.0f, 100.0f,

View File

@@ -50,7 +50,7 @@ glm_euler_angles(mat4 m, vec3 dest) {
int path; int path;
a[0][1] = asinf(-m[0][2]); a[0][1] = asinf(-m[0][2]);
a[1][1] = M_PI - a[0][1]; a[1][1] = CGLM_PI - a[0][1];
cy1 = cosf(a[0][1]); cy1 = cosf(a[0][1]);
cy2 = cosf(a[1][1]); cy2 = cosf(a[1][1]);
@@ -67,12 +67,12 @@ glm_euler_angles(mat4 m, vec3 dest) {
glm_vec_dup(a[path], dest); glm_vec_dup(a[path], dest);
} else { } else {
dest[0] = atan2f(m[1][0], m[2][0]); dest[0] = atan2f(m[1][0], m[2][0]);
dest[1] = M_PI_2; dest[1] = CGLM_PI_2;
dest[2] = 0.0f; dest[2] = 0.0f;
} }
} else { } else {
dest[0] = atan2f(-m[1][0], -m[2][0]); dest[0] = atan2f(-m[1][0], -m[2][0]);
dest[1] =-M_PI_2; dest[1] =-CGLM_PI_2;
dest[2] = 0.0f; dest[2] = 0.0f;
} }
} }

View File

@@ -23,4 +23,8 @@ typedef vec4 mat4[4];
typedef vec4 versor; typedef vec4 versor;
#define CGLM_PI (float)M_PI
#define CGLM_PI_2 (float)M_PI_2
#define CGLM_PI_4 (float)M_PI_4
#endif /* cglm_types_h */ #endif /* cglm_types_h */

View File

@@ -24,25 +24,25 @@ glm_sign(int val) {
CGLM_INLINE CGLM_INLINE
float float
glm_rad(float deg) { glm_rad(float deg) {
return deg * M_PI / 180.0f; return deg * CGLM_PI / 180.0f;
} }
CGLM_INLINE CGLM_INLINE
float float
glm_deg(float rad) { glm_deg(float rad) {
return rad * 180.0f / M_PI; return rad * 180.0f / CGLM_PI;
} }
CGLM_INLINE CGLM_INLINE
void void
glm_make_rad(float *deg) { glm_make_rad(float *deg) {
*deg = *deg * M_PI / 180.0f; *deg = *deg * CGLM_PI / 180.0f;
} }
CGLM_INLINE CGLM_INLINE
void void
glm_make_deg(float *rad) { glm_make_deg(float *rad) {
*rad = *rad * 180.0f / M_PI; *rad = *rad * 180.0f / CGLM_PI;
} }
#endif /* cglm_util_h */ #endif /* cglm_util_h */