diff --git a/include/cglm/cam.h b/include/cglm/cam.h index 6e5fc16..6ce5754 100644 --- a/include/cglm/cam.h +++ b/include/cglm/cam.h @@ -293,7 +293,7 @@ CGLM_INLINE void glm_perspective_default(float aspect, mat4 dest) { - glm_perspective((float)CGLM_PI_4, + glm_perspective(GLM_PI_4f, aspect, 0.01f, 100.0f, diff --git a/include/cglm/ease.h b/include/cglm/ease.h index 30ecf9b..b40b75e 100644 --- a/include/cglm/ease.h +++ b/include/cglm/ease.h @@ -19,19 +19,19 @@ glm_ease_linear(float t) { CGLM_INLINE float glm_ease_sine_in(float t) { - return sinf((t - 1.0f) * CGLM_PI_2) + 1.0f; + return sinf((t - 1.0f) * GLM_PI_2f) + 1.0f; } CGLM_INLINE float glm_ease_sine_out(float t) { - return sinf(t * CGLM_PI_2); + return sinf(t * GLM_PI_2f); } CGLM_INLINE float glm_ease_sine_inout(float t) { - return 0.5f * (1.0f - cosf(t * CGLM_PI)); + return 0.5f * (1.0f - cosf(t * GLM_PIf)); } CGLM_INLINE @@ -254,13 +254,13 @@ glm_ease_back_inout(float t) { CGLM_INLINE float glm_ease_elast_in(float t) { - return sinf(13.0f * CGLM_PI_2 * t) * powf(2.0f, 10.0f * (t - 1.0f)); + return sinf(13.0f * GLM_PI_2f * t) * powf(2.0f, 10.0f * (t - 1.0f)); } CGLM_INLINE float glm_ease_elast_out(float t) { - return sinf(-13.0f * CGLM_PI_2 * (t + 1.0f)) * powf(2.0f, -10.0f * t) + 1.0f; + return sinf(-13.0f * GLM_PI_2f * (t + 1.0f)) * powf(2.0f, -10.0f * t) + 1.0f; } CGLM_INLINE @@ -271,10 +271,10 @@ glm_ease_elast_inout(float t) { a = 2.0f * t; if (t < 0.5f) - return 0.5f * sinf(13.0f * CGLM_PI_2 * a) + return 0.5f * sinf(13.0f * GLM_PI_2f * a) * powf(2.0f, 10.0f * (a - 1.0f)); - return 0.5f * (sinf(-13.0f * CGLM_PI_2 * a) + return 0.5f * (sinf(-13.0f * GLM_PI_2f * a) * powf(2.0f, -10.0f * (a - 1.0f)) + 2.0f); } diff --git a/include/cglm/euler.h b/include/cglm/euler.h index bb455a8..1ff5f6d 100644 --- a/include/cglm/euler.h +++ b/include/cglm/euler.h @@ -84,12 +84,12 @@ glm_euler_angles(mat4 m, vec3 dest) { thetaZ = atan2f(-m10, m00); } else { /* m20 == -1 */ /* Not a unique solution */ - thetaY = -CGLM_PI_2; + thetaY = -GLM_PI_2f; thetaX = -atan2f(m01, m11); thetaZ = 0.0f; } } else { /* m20 == +1 */ - thetaY = CGLM_PI_2; + thetaY = GLM_PI_2f; thetaX = atan2f(m01, m11); thetaZ = 0.0f; } diff --git a/include/cglm/quat.h b/include/cglm/quat.h index 289b0ad..d07db8e 100644 --- a/include/cglm/quat.h +++ b/include/cglm/quat.h @@ -689,7 +689,7 @@ glm_quat_for(vec3 dir, vec3 fwd, vec3 up, versor dest) { dot = glm_vec_dot(dir, fwd); if (fabsf(dot + 1.0f) < 0.000001f) { - glm_quat_init(dest, up[0], up[1], up[2], CGLM_PI); + glm_quat_init(dest, up[0], up[1], up[2], GLM_PIf); return; } diff --git a/include/cglm/util.h b/include/cglm/util.h index 321b152..af73eb8 100644 --- a/include/cglm/util.h +++ b/include/cglm/util.h @@ -58,7 +58,7 @@ glm_signf(float val) { CGLM_INLINE float glm_rad(float deg) { - return deg * CGLM_PI / 180.0f; + return deg * GLM_PIf / 180.0f; } /*! @@ -69,7 +69,7 @@ glm_rad(float deg) { CGLM_INLINE float glm_deg(float rad) { - return rad * 180.0f / CGLM_PI; + return rad * 180.0f / GLM_PIf; } /*! @@ -80,7 +80,7 @@ glm_deg(float rad) { CGLM_INLINE void glm_make_rad(float *deg) { - *deg = *deg * CGLM_PI / 180.0f; + *deg = *deg * GLM_PIf / 180.0f; } /*! @@ -91,7 +91,7 @@ glm_make_rad(float *deg) { CGLM_INLINE void glm_make_deg(float *rad) { - *rad = *rad * 180.0f / CGLM_PI; + *rad = *rad * 180.0f / GLM_PIf; } /*! diff --git a/test/src/test_affine.c b/test/src/test_affine.c index aebd0ff..bb1be15 100644 --- a/test/src/test_affine.c +++ b/test/src/test_affine.c @@ -12,7 +12,7 @@ test_affine(void **state) { mat4 t1, t2, t3, t4, t5; /* test translate is postmultiplied */ - glmc_rotate_make(t1, CGLM_PI_4, GLM_YUP); + glmc_rotate_make(t1, GLM_PI_4f, GLM_YUP); glm_translate_make(t2, (vec3){34, 57, 36}); glmc_mat4_mul(t1, t2, t3); /* R * T */ @@ -21,16 +21,16 @@ test_affine(void **state) { test_assert_mat4_eq(t1, t3); /* test rotate is postmultiplied */ - glmc_rotate_make(t1, CGLM_PI_4, GLM_YUP); + glmc_rotate_make(t1, GLM_PI_4f, GLM_YUP); glm_translate_make(t2, (vec3){34, 57, 36}); glmc_mat4_mul(t2, t1, t3); /* T * R */ - glm_rotate(t2, CGLM_PI_4, GLM_YUP); + glm_rotate(t2, GLM_PI_4f, GLM_YUP); test_assert_mat4_eq(t2, t3); /* test scale is postmultiplied */ - glmc_rotate_make(t1, CGLM_PI_4, GLM_YUP); + glmc_rotate_make(t1, GLM_PI_4f, GLM_YUP); glm_translate_make(t2, (vec3){34, 57, 36}); glm_scale_make(t4, (vec3){3, 5, 6}); @@ -41,7 +41,7 @@ test_affine(void **state) { test_assert_mat4_eq(t3, t5); /* test translate_x */ - glmc_rotate_make(t1, CGLM_PI_4, GLM_YUP); + glmc_rotate_make(t1, GLM_PI_4f, GLM_YUP); glm_translate_make(t2, (vec3){34, 0, 0}); glmc_mat4_mul(t1, t2, t3); /* R * T */ @@ -49,7 +49,7 @@ test_affine(void **state) { test_assert_mat4_eq(t1, t3); /* test translate_y */ - glmc_rotate_make(t1, CGLM_PI_4, GLM_YUP); + glmc_rotate_make(t1, GLM_PI_4f, GLM_YUP); glm_translate_make(t2, (vec3){0, 57, 0}); glmc_mat4_mul(t1, t2, t3); /* R * T */ @@ -57,7 +57,7 @@ test_affine(void **state) { test_assert_mat4_eq(t1, t3); /* test translate_z */ - glmc_rotate_make(t1, CGLM_PI_4, GLM_YUP); + glmc_rotate_make(t1, GLM_PI_4f, GLM_YUP); glm_translate_make(t2, (vec3){0, 0, 36}); glmc_mat4_mul(t1, t2, t3); /* R * T */ @@ -65,43 +65,43 @@ test_affine(void **state) { test_assert_mat4_eq(t1, t3); /* test rotate_x */ - glmc_rotate_make(t1, CGLM_PI_4, (vec3){1, 0, 0}); + glmc_rotate_make(t1, GLM_PI_4f, (vec3){1, 0, 0}); glm_translate_make(t2, (vec3){34, 57, 36}); glmc_mat4_mul(t2, t1, t3); /* T * R */ - glm_rotate_x(t2, CGLM_PI_4, t2); + glm_rotate_x(t2, GLM_PI_4f, t2); test_assert_mat4_eq(t2, t3); /* test rotate_y */ - glmc_rotate_make(t1, CGLM_PI_4, (vec3){0, 1, 0}); + glmc_rotate_make(t1, GLM_PI_4f, (vec3){0, 1, 0}); glm_translate_make(t2, (vec3){34, 57, 36}); glmc_mat4_mul(t2, t1, t3); /* T * R */ - glm_rotate_y(t2, CGLM_PI_4, t2); + glm_rotate_y(t2, GLM_PI_4f, t2); test_assert_mat4_eq(t2, t3); /* test rotate_z */ - glmc_rotate_make(t1, CGLM_PI_4, (vec3){0, 0, 1}); + glmc_rotate_make(t1, GLM_PI_4f, (vec3){0, 0, 1}); glm_translate_make(t2, (vec3){34, 57, 36}); glmc_mat4_mul(t2, t1, t3); /* T * R */ - glm_rotate_z(t2, CGLM_PI_4, t2); + glm_rotate_z(t2, GLM_PI_4f, t2); test_assert_mat4_eq(t2, t3); /* test rotate */ - glmc_rotate_make(t1, CGLM_PI_4, (vec3){0, 0, 1}); + glmc_rotate_make(t1, GLM_PI_4f, (vec3){0, 0, 1}); glm_translate_make(t2, (vec3){34, 57, 36}); glmc_mat4_mul(t2, t1, t3); /* T * R */ - glmc_rotate(t2, CGLM_PI_4, (vec3){0, 0, 1}); + glmc_rotate(t2, GLM_PI_4f, (vec3){0, 0, 1}); test_assert_mat4_eq(t3, t2); /* test scale_uni */ - glmc_rotate_make(t1, CGLM_PI_4, GLM_YUP); + glmc_rotate_make(t1, GLM_PI_4f, GLM_YUP); glm_translate_make(t2, (vec3){34, 57, 36}); glm_scale_make(t4, (vec3){3, 3, 3});