diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-10-10 00:39:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-10-10 00:44:03 +0400 |
commit | 30dab51c29e863d3f605343f6308c71d0a6d3ce1 (patch) | |
tree | 5bb2f3ca81cff63ac0529277114bb373ebb5424a | |
parent | ad4980ce5e411e094bd2ccb67dfab4d1fa697a83 (diff) |
Cleanup: use bool and const args
-rw-r--r-- | source/blender/blenkernel/BKE_pbvh.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 9 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_math_geom.h | 19 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 28 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bisect_plane.c | 7 | ||||
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bisect_plane.h | 7 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 5 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 4 |
9 files changed, 52 insertions, 38 deletions
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 53e41c1dec8..c8c693fc342 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -89,9 +89,10 @@ void BKE_pbvh_search_gather(PBVH *bvh, * it's up to the callback to find the primitive within the leaves that is * hit first */ -void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data, - const float ray_start[3], const float ray_normal[3], - int original); +void BKE_pbvh_raycast( + PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data, + const float ray_start[3], const float ray_normal[3], + bool original); bool BKE_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use_origco, const float ray_start[3], const float ray_normal[3], diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 3e763016efb..ff6fae08460 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1433,7 +1433,7 @@ void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *pro typedef struct { IsectRayAABBData ray; - int original; + bool original; } RaycastData; static bool ray_aabb_intersect(PBVHNode *node, void *data_v) @@ -1449,9 +1449,10 @@ static bool ray_aabb_intersect(PBVHNode *node, void *data_v) return isect_ray_aabb(&rcd->ray, bb_min, bb_max, &node->tmin); } -void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data, - const float ray_start[3], const float ray_normal[3], - int original) +void BKE_pbvh_raycast( + PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data, + const float ray_start[3], const float ray_normal[3], + bool original) { RaycastData rcd; diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 81ca2908619..ba32b29becc 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -275,17 +275,22 @@ void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f /********************************** Normals **********************************/ -void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3], - float n4[3], const float f_no[3], const float co1[3], const float co2[3], - const float co3[3], const float co4[3]); +void accumulate_vertex_normals( + float n1[3], float n2[3], float n3[3], float n4[3], + const float f_no[3], + const float co1[3], const float co2[3], const float co3[3], const float co4[3]); -void accumulate_vertex_normals_poly(float **vertnos, const float polyno[3], - const float **vertcos, float vdiffs[][3], const int nverts); +void accumulate_vertex_normals_poly( + float **vertnos, const float polyno[3], + const float **vertcos, float vdiffs[][3], const int nverts); /********************************* Tangents **********************************/ -void tangent_from_uv(float uv1[2], float uv2[2], float uv3[2], - float co1[3], float co2[3], float co3[3], float n[3], float tang[3]); +void tangent_from_uv( + const float uv1[2], const float uv2[2], const float uv3[2], + const float co1[3], const float co2[3], const float co3[3], + const float n[3], + float r_tang[3]); /******************************** Vector Clouds ******************************/ diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 496e5362cc4..da0855ad022 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -3231,9 +3231,10 @@ void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f /********************************* Normals **********************************/ -void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3], - float n4[3], const float f_no[3], const float co1[3], const float co2[3], - const float co3[3], const float co4[3]) +void accumulate_vertex_normals( + float n1[3], float n2[3], float n3[3], float n4[3], + const float f_no[3], + const float co1[3], const float co2[3], const float co3[3], const float co4[3]) { float vdiffs[4][3]; const int nverts = (n4 != NULL && co4 != NULL) ? 4 : 3; @@ -3305,7 +3306,11 @@ void accumulate_vertex_normals_poly(float **vertnos, const float polyno[3], /********************************* Tangents **********************************/ -void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], float co2[3], float co3[3], float n[3], float tang[3]) +void tangent_from_uv( + const float uv1[2], const float uv2[2], const float uv3[3], + const float co1[3], const float co2[3], const float co3[3], + const float n[3], + float r_tang[3]) { const float s1 = uv2[0] - uv1[0]; const float s2 = uv3[0] - uv1[0]; @@ -3313,7 +3318,8 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], flo const float t2 = uv3[1] - uv1[1]; float det = (s1 * t2 - s2 * t1); - if (det != 0.0f) { /* otherwise 'tang' becomes nan */ + /* otherwise 'r_tang' becomes nan */ + if (det != 0.0f) { float tangv[3], ct[3], e1[3], e2[3]; det = 1.0f / det; @@ -3321,21 +3327,21 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], flo /* normals in render are inversed... */ sub_v3_v3v3(e1, co1, co2); sub_v3_v3v3(e2, co1, co3); - tang[0] = (t2 * e1[0] - t1 * e2[0]) * det; - tang[1] = (t2 * e1[1] - t1 * e2[1]) * det; - tang[2] = (t2 * e1[2] - t1 * e2[2]) * det; + r_tang[0] = (t2 * e1[0] - t1 * e2[0]) * det; + r_tang[1] = (t2 * e1[1] - t1 * e2[1]) * det; + r_tang[2] = (t2 * e1[2] - t1 * e2[2]) * det; tangv[0] = (s1 * e2[0] - s2 * e1[0]) * det; tangv[1] = (s1 * e2[1] - s2 * e1[1]) * det; tangv[2] = (s1 * e2[2] - s2 * e1[2]) * det; - cross_v3_v3v3(ct, tang, tangv); + cross_v3_v3v3(ct, r_tang, tangv); /* check flip */ if (dot_v3v3(ct, n) < 0.0f) { - negate_v3(tang); + negate_v3(r_tang); } } else { - tang[0] = tang[1] = tang[2] = 0.0f; + zero_v3(r_tang); } } diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c index ed9e8783037..463304f27f7 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.c +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c @@ -294,9 +294,10 @@ finally: * \param use_tag Only bisect tagged edges and faces. * \param oflag_center Operator flag, enabled for geometry on the axis (existing and created) */ -void BM_mesh_bisect_plane(BMesh *bm, float plane[4], - const bool use_snap_center, const bool use_tag, - const short oflag_center, const float eps) +void BM_mesh_bisect_plane( + BMesh *bm, const float plane[4], + const bool use_snap_center, const bool use_tag, + const short oflag_center, const float eps) { unsigned int einput_len; unsigned int i; diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.h b/source/blender/bmesh/tools/bmesh_bisect_plane.h index 15f902642c8..7f3a97c4c79 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.h +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.h @@ -27,8 +27,9 @@ * \ingroup bmesh */ -void BM_mesh_bisect_plane(BMesh *bm, float plane[4], - const bool use_snap_center, const bool use_tag, - const short oflag_center, const float eps); +void BM_mesh_bisect_plane( + BMesh *bm, const float plane[4], + const bool use_snap_center, const bool use_tag, + const short oflag_center, const float eps); #endif /* __BMESH_BISECT_PLANE_H__ */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 2f9734f790f..4b692cfd741 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -8747,8 +8747,9 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle switch (event->type) { case MOUSEMOVE: - if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ && - !is_click_style) { + if (!is_click_style && + (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ)) + { block->pie_data.flags |= UI_PIE_DRAG_STYLE; } ui_handle_menu_button(C, event, menu); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 766048d54bb..0e0012c198f 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -268,8 +268,8 @@ typedef struct { /* Original coordinate, normal, and mask */ const float *co; - float mask; const short *no; + float mask; } SculptOrigVertData; @@ -4008,7 +4008,7 @@ typedef struct { const float *ray_start, *ray_normal; bool hit; float dist; - int original; + bool original; } SculptRaycastData; typedef struct { diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 0e3621aa91f..b3accb431ee 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -434,9 +434,7 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl) BGpic *bgpic; /* clear or remove stuff from old */ - -// XXX BIF_view3d_previewrender_free(v3do); - + if (v3dn->localvd) { v3dn->localvd = NULL; v3dn->properties_storage = NULL; |