From dc399ee846dfe31c249ce1f7fe27fabe5afac2a8 Mon Sep 17 00:00:00 2001 From: Hallam Roberts Date: Fri, 11 Mar 2022 16:14:05 +0100 Subject: Cleanup: use M_PI_2 and M_PI_4 where possible The constant M_PI_4 is added to GLSL to ensure it works there too. Differential Revision: https://developer.blender.org/D14288 --- source/blender/blenkernel/intern/armature_test.cc | 2 +- source/blender/blenkernel/intern/mask.c | 4 ++-- source/blender/blenkernel/intern/particle_child.c | 2 +- source/blender/blenlib/intern/math_base_inline.c | 8 ++++---- source/blender/blenlib/intern/math_vector.c | 4 ++-- source/blender/blenloader/intern/versioning_280.c | 2 +- source/blender/bmesh/tools/bmesh_bevel.c | 2 +- source/blender/draw/engines/eevee/eevee_lightprobes.c | 2 +- source/blender/draw/engines/eevee/eevee_lookdev.c | 2 +- .../draw/engines/eevee/shaders/effect_dof_scatter_vert.glsl | 2 +- .../draw/engines/eevee/shaders/effect_translucency_frag.glsl | 2 +- source/blender/draw/engines/gpencil/gpencil_draw_data.c | 2 +- source/blender/draw/engines/workbench/workbench_effect_dof.c | 8 ++++---- source/blender/draw/intern/shaders/common_math_lib.glsl | 1 + source/blender/editors/curve/editcurve.c | 2 +- source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c | 2 +- source/blender/editors/space_view3d/view3d_navigate.c | 8 ++++---- source/blender/editors/uvedit/uvedit_parametrizer.c | 10 +++++----- source/blender/freestyle/intern/geometry/matrix_util.cpp | 2 +- source/blender/freestyle/intern/winged_edge/Curvature.cpp | 4 ++-- source/blender/freestyle/intern/winged_edge/WEdge.h | 4 ++-- source/blender/gpu/intern/gpu_immediate_util.c | 4 ++-- source/blender/io/collada/collada_internal.cpp | 4 ++-- source/blender/io/usd/intern/usd_capi_import.cc | 2 +- source/blender/makesdna/DNA_modifier_defaults.h | 2 +- source/blender/makesrna/intern/rna_brush.c | 2 +- source/blender/makesrna/intern/rna_camera.c | 4 ++-- source/blender/makesrna/intern/rna_cloth.c | 2 +- 28 files changed, 48 insertions(+), 47 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/armature_test.cc b/source/blender/blenkernel/intern/armature_test.cc index 7475e6f36d4..4d266c8493a 100644 --- a/source/blender/blenkernel/intern/armature_test.cc +++ b/source/blender/blenkernel/intern/armature_test.cc @@ -285,7 +285,7 @@ TEST(vec_roll_to_mat3_normalized, Roll1) const float expected_roll_mat[3][3] = {{0.211324856f, 0.577350259f, -0.788675129f}, {0.577350259f, 0.577350259f, 0.577350259f}, {0.788675129f, -0.577350259f, -0.211324856f}}; - test_vec_roll_to_mat3_normalized(input, float(M_PI * 0.5), expected_roll_mat); + test_vec_roll_to_mat3_normalized(input, float(M_PI_2), expected_roll_mat); } /** Test that the matrix is orthogonal for an input close to -Y. */ diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index da0f899001c..42e65a95404 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -609,7 +609,7 @@ float BKE_mask_spline_project_co(MaskSpline *spline, if (len_squared_v2(v1) > proj_eps_sq) { ang1 = angle_v2v2(v1, n1); - if (ang1 > (float)M_PI / 2.0f) { + if (ang1 > (float)M_PI_2) { ang1 = (float)M_PI - ang1; } @@ -635,7 +635,7 @@ float BKE_mask_spline_project_co(MaskSpline *spline, if (len_squared_v2(v2) > proj_eps_sq) { ang2 = angle_v2v2(v2, n2); - if (ang2 > (float)M_PI / 2.0f) { + if (ang2 > (float)M_PI_2) { ang2 = (float)M_PI - ang2; } diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c index 7a2e4eb4ac9..8106ae8b302 100644 --- a/source/blender/blenkernel/intern/particle_child.c +++ b/source/blender/blenkernel/intern/particle_child.c @@ -85,7 +85,7 @@ static void do_kink_spiral_deform(ParticleKey *state, * and goes up to the Golden Spiral for 1.0 * https://en.wikipedia.org/wiki/Golden_spiral */ - const float b = shape * (1.0f + sqrtf(5.0f)) / (float)M_PI * 0.25f; + const float b = shape * (1.0f + sqrtf(5.0f)) / (float)M_PI_4; /* angle of the spiral against the curve (rotated opposite to make a smooth transition) */ const float start_angle = ((b != 0.0f) ? atanf(1.0f / b) : (float)-M_PI_2) + (b > 0.0f ? -(float)M_PI_2 : (float)M_PI_2); diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index 90a91cbe26f..bb6bc0db00d 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -95,10 +95,10 @@ MINLINE float saacos(float fac) MINLINE float saasin(float fac) { if (UNLIKELY(fac <= -1.0f)) { - return (float)-M_PI / 2.0f; + return (float)-M_PI_2; } else if (UNLIKELY(fac >= 1.0f)) { - return (float)M_PI / 2.0f; + return (float)M_PI_2; } else { return asinf(fac); @@ -131,10 +131,10 @@ MINLINE float saacosf(float fac) MINLINE float saasinf(float fac) { if (UNLIKELY(fac <= -1.0f)) { - return (float)-M_PI / 2.0f; + return (float)-M_PI_2; } else if (UNLIKELY(fac >= 1.0f)) { - return (float)M_PI / 2.0f; + return (float)M_PI_2; } else { return asinf(fac); diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c index e71b1150d8f..da6a6dff16f 100644 --- a/source/blender/blenlib/intern/math_vector.c +++ b/source/blender/blenlib/intern/math_vector.c @@ -289,7 +289,7 @@ void mid_v3_v3v3_angle_weighted(float r[3], const float a[3], const float b[3]) BLI_ASSERT_UNIT_V3(b); add_v3_v3v3(r, a, b); - angle = ((float)(1.0 / (M_PI / 2.0)) * + angle = ((float)M_2_PI * /* normally we would only multiply by 2, * but instead of an angle make this 0-1 factor */ 2.0f) * @@ -305,7 +305,7 @@ void mid_v3_angle_weighted(float r[3]) /* double check they are normalized */ BLI_assert(len_squared_v3(r) <= 1.0f + FLT_EPSILON); - angle = ((float)(1.0 / (M_PI / 2.0)) * + angle = ((float)M_2_PI * /* normally we would only multiply by 2, * but instead of an angle make this 0-1 factor */ 2.0f) * diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 3700ead92f0..b1c982649d2 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -4497,7 +4497,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) clmd->sim_parms->max_internal_tension = 15.0f; clmd->sim_parms->internal_compression = 15.0f; clmd->sim_parms->max_internal_compression = 15.0f; - clmd->sim_parms->internal_spring_max_diversion = M_PI / 4.0f; + clmd->sim_parms->internal_spring_max_diversion = M_PI_4; } } } diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index a550b638e46..5790d76936f 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -7106,7 +7106,7 @@ static void find_even_superellipse_chords(int n, float r, double *xvals, double return; } if (r == PRO_CIRCLE_R) { - double temp = (M_PI / 2) / n; + double temp = M_PI_2 / n; /* Angle spacing. */ for (int i = 0; i <= n; i++) { xvals[i] = sin(i * temp); diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index a20fe156eda..7029d015b22 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -613,7 +613,7 @@ void EEVEE_lightprobes_planar_data_from_object(Object *ob, eplanar->clip_edge_y_neg = dot_v3v3(eplanar->clip_vec_y, vec); /* Facing factors */ - float max_angle = max_ff(1e-2f, 1.0f - probe->falloff) * M_PI * 0.5f; + float max_angle = max_ff(1e-2f, 1.0f - probe->falloff) * M_PI_2; float min_angle = 0.0f; eplanar->facing_scale = 1.0f / max_ff(1e-8f, cosf(min_angle) - cosf(max_angle)); eplanar->facing_bias = -min_ff(1.0f - 1e-8f, cosf(max_angle)) * eplanar->facing_scale; diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c index 0ef78d97a79..874c2815b8b 100644 --- a/source/blender/draw/engines/eevee/eevee_lookdev.c +++ b/source/blender/draw/engines/eevee/eevee_lookdev.c @@ -217,7 +217,7 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata, float x_rot_matrix[3][3]; DRW_view_viewmat_get(NULL, view_matrix, false); copy_m3_m4(view_rot_matrix, view_matrix); - axis_angle_to_mat3_single(x_rot_matrix, 'X', M_PI / 2.0f); + axis_angle_to_mat3_single(x_rot_matrix, 'X', M_PI_2); mul_m3_m3m3(view_rot_matrix, x_rot_matrix, view_rot_matrix); mul_m3_m3m3(view_rot_matrix, g_data->studiolight_matrix, view_rot_matrix); copy_m3_m3(studiolight_matrix, view_rot_matrix); diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_vert.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_vert.glsl index 59564890d7e..b05223e755d 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_vert.glsl @@ -103,7 +103,7 @@ void main() color4 = colors[3] * weights[3]; /* Extend to cover at least the unit circle */ - const float extend = (cos(M_PI / 4.0) + 1.0) * 2.0; + const float extend = (cos(M_PI_4) + 1.0) * 2.0; /* Crappy diagram * ex 1 * | \ diff --git a/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl index ba90f5ae531..831ed0a119a 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl @@ -40,7 +40,7 @@ float light_translucent_power_with_falloff(LightData ld, vec3 N, vec4 l_vector) if (ld.l_type >= AREA_RECT) { power = (ld.l_sizex * ld.l_sizey * 4.0 * M_PI) * (1.0 / 80.0); if (ld.l_type == AREA_ELLIPSE) { - power *= M_PI * 0.25; + power *= M_PI_4; } power *= 0.3 * 20.0 * max(0.0, dot(-ld.l_forward, l_vector.xyz / l_vector.w)); /* XXX ad hoc, empirical */ diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_data.c b/source/blender/draw/engines/gpencil/gpencil_draw_data.c index 6c904745709..c3f96ecd0a2 100644 --- a/source/blender/draw/engines/gpencil/gpencil_draw_data.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_data.c @@ -387,7 +387,7 @@ void gpencil_light_pool_populate(GPENCIL_LightPool *lightpool, Object *ob) normalize_m4_m4(mat, ob->obmat); invert_m4(mat); gp_light->type = GP_LIGHT_TYPE_SPOT; - gp_light->spotsize = cosf(M_PI * 0.5f); + gp_light->spotsize = cosf(M_PI_2); gp_light->spotblend = (1.0f - gp_light->spotsize) * 1.0f; } else if (la->type == LA_SUN) { diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c index 6b64a9d7f09..58d49cf226e 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_dof.c +++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c @@ -31,22 +31,22 @@ static void square_to_circle(float x, float y, float *r, float *T) if (x > -y) { if (x > y) { *r = x; - *T = (M_PI / 4.0f) * (y / x); + *T = M_PI_4 * (y / x); } else { *r = y; - *T = (M_PI / 4.0f) * (2 - (x / y)); + *T = M_PI_4 * (2 - (x / y)); } } else { if (x < y) { *r = -x; - *T = (M_PI / 4.0f) * (4 + (y / x)); + *T = M_PI_4 * (4 + (y / x)); } else { *r = -y; if (y != 0) { - *T = (M_PI / 4.0f) * (6 - (x / y)); + *T = M_PI_4 * (6 - (x / y)); } else { *T = 0.0f; diff --git a/source/blender/draw/intern/shaders/common_math_lib.glsl b/source/blender/draw/intern/shaders/common_math_lib.glsl index eb7a98788c3..bc31649fd0f 100644 --- a/source/blender/draw/intern/shaders/common_math_lib.glsl +++ b/source/blender/draw/intern/shaders/common_math_lib.glsl @@ -6,6 +6,7 @@ #define M_PI 3.14159265358979323846 /* pi */ #define M_2PI 6.28318530717958647692 /* 2*pi */ #define M_PI_2 1.57079632679489661923 /* pi/2 */ +#define M_PI_4 0.78539816339744830962 /* pi/4 */ #define M_1_PI 0.318309886183790671538 /* 1/pi */ #define M_1_2PI 0.159154943091895335768 /* 1/(2*pi) */ #define M_1_PI2 0.101321183642337771443 /* 1/(pi^2) */ diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index f992309ed00..2dcddd01670 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -4906,7 +4906,7 @@ bool ed_editnurb_spin( copy_m3_m4(bmat, obedit->obmat); invert_m3_m3(imat, bmat); - axis_angle_to_mat3(cmat, axis, M_PI / 4.0); + axis_angle_to_mat3(cmat, axis, M_PI_4); mul_m3_m3m3(tmat, cmat, bmat); mul_m3_m3m3(rotmat, imat, tmat); diff --git a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c index 8d75e2aaf37..687f06c8dcf 100644 --- a/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c +++ b/source/blender/editors/mesh/editmesh_extrude_spin_gizmo.c @@ -44,7 +44,7 @@ # include "BKE_editmesh.h" #endif -static const float dial_angle_partial = M_PI / 2; +static const float dial_angle_partial = M_PI_2; static const float dial_angle_partial_margin = 0.92f; #define ORTHO_AXIS_OFFSET 2 diff --git a/source/blender/editors/space_view3d/view3d_navigate.c b/source/blender/editors/space_view3d/view3d_navigate.c index daf534ce0ba..50d7626a57d 100644 --- a/source/blender/editors/space_view3d/view3d_navigate.c +++ b/source/blender/editors/space_view3d/view3d_navigate.c @@ -1153,16 +1153,16 @@ static int view_axis_exec(bContext *C, wmOperator *op) float quat_test[4]; if (viewnum == RV3D_VIEW_LEFT) { - axis_angle_to_quat(quat_rotate, rv3d->viewinv[1], -M_PI / 2.0f); + axis_angle_to_quat(quat_rotate, rv3d->viewinv[1], -M_PI_2); } else if (viewnum == RV3D_VIEW_RIGHT) { - axis_angle_to_quat(quat_rotate, rv3d->viewinv[1], M_PI / 2.0f); + axis_angle_to_quat(quat_rotate, rv3d->viewinv[1], M_PI_2); } else if (viewnum == RV3D_VIEW_TOP) { - axis_angle_to_quat(quat_rotate, rv3d->viewinv[0], -M_PI / 2.0f); + axis_angle_to_quat(quat_rotate, rv3d->viewinv[0], -M_PI_2); } else if (viewnum == RV3D_VIEW_BOTTOM) { - axis_angle_to_quat(quat_rotate, rv3d->viewinv[0], M_PI / 2.0f); + axis_angle_to_quat(quat_rotate, rv3d->viewinv[0], M_PI_2); } else if (viewnum == RV3D_VIEW_FRONT) { unit_qt(quat_rotate); diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index f19b32e3ad4..3f7c7745bff 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -2059,7 +2059,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair) a1 = a1 - M_PI / 3.0; a2 = a2 - M_PI / 3.0; a3 = a3 - M_PI / 3.0; - shapeold = (a1 * a1 + a2 * a2 + a3 * a3) / ((M_PI / 2) * (M_PI / 2)); + shapeold = (a1 * a1 + a2 * a2 + a3 * a3) / (M_PI_2 * M_PI_2); nshapeold++; } @@ -2068,7 +2068,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair) a1 = a1 - M_PI / 3.0; a2 = a2 - M_PI / 3.0; a3 = a3 - M_PI / 3.0; - shapenew = (a1 * a1 + a2 * a2 + a3 * a3) / ((M_PI / 2) * (M_PI / 2)); + shapenew = (a1 * a1 + a2 * a2 + a3 * a3) / (M_PI_2 * M_PI_2); nshapenew++; } @@ -3730,7 +3730,7 @@ static float p_chart_minimum_area_angle(PChart *chart) minarea = 1e10; minangle = 0.0; - while (rotated <= (float)(M_PI / 2.0)) { /* INVESTIGATE: how far to rotate? */ + while (rotated <= (float)M_PI_2) { /* INVESTIGATE: how far to rotate? */ /* rotate with the smallest angle */ i_min = 0; mina = 1e10; @@ -3777,8 +3777,8 @@ static float p_chart_minimum_area_angle(PChart *chart) } /* try keeping rotation as small as possible */ - if (minangle > (float)(M_PI / 4)) { - minangle -= (float)(M_PI / 2.0); + if (minangle > (float)M_PI_4) { + minangle -= (float)M_PI_2; } MEM_freeN(angles); diff --git a/source/blender/freestyle/intern/geometry/matrix_util.cpp b/source/blender/freestyle/intern/geometry/matrix_util.cpp index ecf5443a957..35503a37685 100644 --- a/source/blender/freestyle/intern/geometry/matrix_util.cpp +++ b/source/blender/freestyle/intern/geometry/matrix_util.cpp @@ -106,7 +106,7 @@ void semi_definite_symmetric_eigen(const double *mat, int n, double *eigen_vec, delta = a_ll - a_mm; if (delta == 0.0) { - x = -M_PI / 4; + x = -M_PI_4; } else { x = -atan((a_lm + a_lm) / delta) / 2.0; diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp index fba3110907a..9086593a945 100644 --- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp +++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp @@ -474,10 +474,10 @@ inline static real angle(WOEdge *h) const Vec3r v = h->GetVec(); real sine = (n1 ^ n2) * v / v.norm(); if (sine >= 1.0) { - return M_PI / 2.0; + return M_PI_2; } if (sine <= -1.0) { - return -M_PI / 2.0; + return -M_PI_2; } return ::asin(sine); } diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h index b77381bd4e5..6d39446056f 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WEdge.h @@ -1400,11 +1400,11 @@ inline void WOEdge::setVecAndAngle() if (_paFace && _pbFace) { float sine = (_pbFace->GetNormal() ^ _paFace->GetNormal()) * _vec / _vec.norm(); if (sine >= 1.0) { - _angle = M_PI / 2.0; + _angle = M_PI_2; return; } if (sine <= -1.0) { - _angle = -M_PI / 2.0; + _angle = -M_PI_2; return; } _angle = ::asin(sine); diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c index b2fd60a62e5..cf8837ab26e 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.c +++ b/source/blender/gpu/intern/gpu_immediate_util.c @@ -181,7 +181,7 @@ static void imm_draw_circle_partial(GPUPrimType prim_type, float sweep) { /* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */ - const float angle_start = -(DEG2RADF(start)) + (float)(M_PI / 2); + const float angle_start = -(DEG2RADF(start)) + (float)M_PI_2; const float angle_end = -(DEG2RADF(sweep) - angle_start); nsegments += 1; immBegin(prim_type, nsegments); @@ -215,7 +215,7 @@ static void imm_draw_disk_partial(GPUPrimType prim_type, CLAMP(sweep, -max_angle, max_angle); /* shift & reverse angle, increase 'nsegments' to match gluPartialDisk */ - const float angle_start = -(DEG2RADF(start)) + (float)(M_PI / 2); + const float angle_start = -(DEG2RADF(start)) + (float)M_PI_2; const float angle_end = -(DEG2RADF(sweep) - angle_start); nsegments += 1; immBegin(prim_type, nsegments * 2); diff --git a/source/blender/io/collada/collada_internal.cpp b/source/blender/io/collada/collada_internal.cpp index db27236b885..da9a4cd4a9b 100644 --- a/source/blender/io/collada/collada_internal.cpp +++ b/source/blender/io/collada/collada_internal.cpp @@ -14,8 +14,8 @@ UnitConverter::UnitConverter() : up_axis(COLLADAFW::FileInfo::Z_UP) { - axis_angle_to_mat4_single(x_up_mat4, 'Y', -0.5 * M_PI); - axis_angle_to_mat4_single(y_up_mat4, 'X', 0.5 * M_PI); + axis_angle_to_mat4_single(x_up_mat4, 'Y', -M_PI_2); + axis_angle_to_mat4_single(y_up_mat4, 'X', M_PI_2); unit_m4(z_up_mat4); unit_m4(scale_mat4); diff --git a/source/blender/io/usd/intern/usd_capi_import.cc b/source/blender/io/usd/intern/usd_capi_import.cc index 6186e2bb61f..49d5251198a 100644 --- a/source/blender/io/usd/intern/usd_capi_import.cc +++ b/source/blender/io/usd/intern/usd_capi_import.cc @@ -102,7 +102,7 @@ static void convert_to_z_up(pxr::UsdStageRefPtr stage, ImportSettings *r_setting /* Rotate 90 degrees about the X-axis. */ float rmat[3][3]; float axis[3] = {1.0f, 0.0f, 0.0f}; - axis_angle_normalized_to_mat3(rmat, axis, M_PI / 2.0f); + axis_angle_normalized_to_mat3(rmat, axis, M_PI_2); unit_m4(r_settings->conversion_mat); copy_m4_m3(r_settings->conversion_mat, rmat); diff --git a/source/blender/makesdna/DNA_modifier_defaults.h b/source/blender/makesdna/DNA_modifier_defaults.h index 41cc8048de1..299ac4e2fbe 100644 --- a/source/blender/makesdna/DNA_modifier_defaults.h +++ b/source/blender/makesdna/DNA_modifier_defaults.h @@ -145,7 +145,7 @@ .compression_damp = 5.0f, \ .shear_damp = 5.0f, \ .internal_spring_max_length = 0.0f, \ - .internal_spring_max_diversion = M_PI / 4.0f, \ + .internal_spring_max_diversion = M_PI_4, \ .vgroup_intern = 0, \ .internal_tension = 15.0f, \ .internal_compression = 15.0f, \ diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 39e1609e305..6052a742ad5 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -2984,7 +2984,7 @@ static void rna_def_brush(BlenderRNA *brna) prop = RNA_def_property(srna, "falloff_angle", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "falloff_angle"); - RNA_def_property_range(prop, 0, M_PI / 2); + RNA_def_property_range(prop, 0, M_PI_2); RNA_def_property_ui_text( prop, "Falloff Angle", diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 23f6bb768d6..118589332ea 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -392,13 +392,13 @@ static void rna_def_camera_stereo_data(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); prop = RNA_def_property(srna, "pole_merge_angle_from", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_range(prop, 0.0f, M_PI / 2.0); + RNA_def_property_range(prop, 0.0f, M_PI_2); RNA_def_property_ui_text( prop, "Pole Merge Start Angle", "Angle at which interocular distance starts to fade to 0"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); prop = RNA_def_property(srna, "pole_merge_angle_to", PROP_FLOAT, PROP_ANGLE); - RNA_def_property_range(prop, 0.0f, M_PI / 2.0); + RNA_def_property_range(prop, 0.0f, M_PI_2); RNA_def_property_ui_text( prop, "Pole Merge End Angle", "Angle at which interocular distance is 0"); RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL); diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c index 4ee57017841..3ad901e5397 100644 --- a/source/blender/makesrna/intern/rna_cloth.c +++ b/source/blender/makesrna/intern/rna_cloth.c @@ -922,7 +922,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna) prop = RNA_def_property(srna, "internal_spring_max_diversion", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "internal_spring_max_diversion"); - RNA_def_property_range(prop, 0.0f, M_PI / 4.0f); + RNA_def_property_range(prop, 0.0f, M_PI_4); RNA_def_property_ui_text(prop, "Internal Spring Max Diversion", "How much the rays used to connect the internal points can diverge " -- cgit v1.2.3