From 46eef60d93fd0d52ed4b94750f7a3248db5594ee Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 3 Dec 2013 20:09:25 +0100 Subject: Cleanup: Internal degrees removal. This patch changes most of the reamining degrees usage in internal code into radians. I let a few which I know off asside, for reasons explained below - and I'm not sure to have found out all of them. WARNING: this introduces forward incompatibility, which means files saved from this version won't open 100% correctly in previous versions (a few angle properties would use radians values as degrees...). Details: - Data: -- Lamp.spotsize: Game engine exposed this setting in degrees, to not break the API here I kept it as such (using getter/setter functions), still using radians internally. -- Mesh.smoothresh: Didn't touch to this one, as we will hopefully replace it completely by loop normals currently in dev. - Modifiers: -- EdgeSplitModifierData.split_angle, BevelModifierData.bevel_angle: Done. - Postprocessing: -- WipeVars.angle (sequencer's effect), NodeBokehImage.angle, NodeBoxMask.rotation, NodeEllipseMask.rotation: Done. - BGE: -- bConstraintActuator: Orientation type done (the minloc[0] & maxloc[0] cases). Did not touch to 'limit location' type, it can also limit rotation, but it exposes through RNA the same limit_min/limit_max, which hence can be either distance or angle values, depending on the mode. Will leave this to BGE team. -- bSoundActuator.cone_outer_angle_3d, bSoundActuator.cone_inner_angle_3d: Done (note I kept degrees in BGE itself, as it seems this is the expected value here...). -- bRadarSensor.angle: Done. Reviewers: brecht, campbellbarton, sergey, gaiaclary, dfelinto, moguri, jbakker, lukastoenne, howardt Reviewed By: brecht, campbellbarton, sergey, gaiaclary, moguri, jbakker, lukastoenne, howardt Thanks to all! Differential Revision: http://developer.blender.org/D59 --- source/blender/modifiers/intern/MOD_bevel.c | 4 ++-- source/blender/modifiers/intern/MOD_edgesplit.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/modifiers/intern') diff --git a/source/blender/modifiers/intern/MOD_bevel.c b/source/blender/modifiers/intern/MOD_bevel.c index 6a1de92f9b2..3ba06a73c8b 100644 --- a/source/blender/modifiers/intern/MOD_bevel.c +++ b/source/blender/modifiers/intern/MOD_bevel.c @@ -61,7 +61,7 @@ static void initData(ModifierData *md) bmd->val_flags = 0; bmd->lim_flags = 0; bmd->e_flags = 0; - bmd->bevel_angle = 30; + bmd->bevel_angle = DEG2RADF(30.0f); bmd->defgrp_name[0] = '\0'; } @@ -107,7 +107,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob, int vgroup = -1; MDeformVert *dvert = NULL; BevelModifierData *bmd = (BevelModifierData *) md; - const float threshold = cosf((bmd->bevel_angle + 0.00001f) * (float)M_PI / 180.0f); + const float threshold = cosf(bmd->bevel_angle + 0.000000175f); const bool vertex_only = (bmd->flags & MOD_BEVEL_VERT) != 0; const bool do_clamp = !(bmd->flags & MOD_BEVEL_OVERLAP_OK); diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index d55ebdad939..a17858d58f5 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -55,7 +55,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd) BMesh *bm; BMIter iter; BMEdge *e; - float threshold = cosf((emd->split_angle + 0.00001f) * (float)M_PI / 180.0f); + float threshold = cosf(emd->split_angle + 0.000000175f); const bool calc_face_normals = (emd->flags & MOD_EDGESPLIT_FROMANGLE) != 0; bm = DM_to_bmesh(dm, calc_face_normals); @@ -107,7 +107,7 @@ static void initData(ModifierData *md) EdgeSplitModifierData *emd = (EdgeSplitModifierData *) md; /* default to 30-degree split angle, sharpness from both angle & flag */ - emd->split_angle = 30; + emd->split_angle = DEG2RADF(30.0f); emd->flags = MOD_EDGESPLIT_FROMANGLE | MOD_EDGESPLIT_FROMFLAG; } -- cgit v1.2.3