Cleanup: function arg wrapping

This commit is contained in:
2015-05-05 15:59:26 +10:00
parent 1648feec94
commit ea5f9fee8d
10 changed files with 132 additions and 99 deletions

View File

@@ -87,8 +87,9 @@ static void bm_vert_loop_pair(BMesh *bm, BMVert *v1, BMVert *v2, BMLoop **l1, BM
}
/* el_b can have any offset */
static float bm_edgeloop_offset_length(LinkData *el_a, LinkData *el_b,
LinkData *el_b_first, const float len_max)
static float bm_edgeloop_offset_length(
LinkData *el_a, LinkData *el_b,
LinkData *el_b_first, const float len_max)
{
float len = 0.0f;
BLI_assert(el_a->prev == NULL); /* must be first */
@@ -137,10 +138,11 @@ static bool bm_edge_test_cb(BMEdge *e, void *bm_v)
return BMO_elem_flag_test((BMesh *)bm_v, e, EDGE_MARK);
}
static void bridge_loop_pair(BMesh *bm,
struct BMEdgeLoopStore *el_store_a,
struct BMEdgeLoopStore *el_store_b,
const bool use_merge, const float merge_factor, const int twist_offset)
static void bridge_loop_pair(
BMesh *bm,
struct BMEdgeLoopStore *el_store_a,
struct BMEdgeLoopStore *el_store_b,
const bool use_merge, const float merge_factor, const int twist_offset)
{
const float eps = 0.00001f;
LinkData *el_a_first, *el_b_first;

View File

@@ -152,8 +152,9 @@ static void min_dist_dir_update(MinDistDir *dist, const float dist_dir[3])
/** \} */
static int state_isect_co_pair(const PathContext *pc,
const float co_a[3], const float co_b[3])
static int state_isect_co_pair(
const PathContext *pc,
const float co_a[3], const float co_b[3])
{
const float diff_a = dot_m3_v3_row_x((float (*)[3])pc->matrix, co_a) - pc->axis_sep;
const float diff_b = dot_m3_v3_row_x((float (*)[3])pc->matrix, co_b) - pc->axis_sep;
@@ -169,15 +170,17 @@ static int state_isect_co_pair(const PathContext *pc,
}
}
static int state_isect_co_exact(const PathContext *pc,
const float co[3])
static int state_isect_co_exact(
const PathContext *pc,
const float co[3])
{
const float diff = dot_m3_v3_row_x((float (*)[3])pc->matrix, co) - pc->axis_sep;
return (fabsf(diff) <= CONNECT_EPS);
}
static float state_calc_co_pair_fac(const PathContext *pc,
const float co_a[3], const float co_b[3])
static float state_calc_co_pair_fac(
const PathContext *pc,
const float co_a[3], const float co_b[3])
{
float diff_a, diff_b, diff_tot;
@@ -187,9 +190,10 @@ static float state_calc_co_pair_fac(const PathContext *pc,
return (diff_tot > FLT_EPSILON) ? (diff_a / diff_tot) : 0.5f;
}
static void state_calc_co_pair(const PathContext *pc,
const float co_a[3], const float co_b[3],
float r_co[3])
static void state_calc_co_pair(
const PathContext *pc,
const float co_a[3], const float co_b[3],
float r_co[3])
{
const float fac = state_calc_co_pair_fac(pc, co_a, co_b);
interp_v3_v3v3(r_co, co_a, co_b, fac);
@@ -213,8 +217,9 @@ static bool state_link_find(const PathLinkState *state, BMElem *ele)
return false;
}
static void state_link_add(PathContext *pc, PathLinkState *state,
BMElem *ele, BMElem *ele_from)
static void state_link_add(
PathContext *pc, PathLinkState *state,
BMElem *ele, BMElem *ele_from)
{
PathLink *step_new = BLI_mempool_alloc(pc->link_pool);
BLI_assert(ele != ele_from);

View File

@@ -44,9 +44,10 @@
*
* Copy an existing vertex from one bmesh to another.
*/
static BMVert *bmo_vert_copy(BMOperator *op,
BMOpSlot *slot_vertmap_out,
BMesh *bm_dst, BMesh *bm_src, BMVert *v_src, GHash *vhash)
static BMVert *bmo_vert_copy(
BMOperator *op,
BMOpSlot *slot_vertmap_out,
BMesh *bm_dst, BMesh *bm_src, BMVert *v_src, GHash *vhash)
{
BMVert *v_dst;
@@ -72,12 +73,13 @@ static BMVert *bmo_vert_copy(BMOperator *op,
*
* Copy an existing edge from one bmesh to another.
*/
static BMEdge *bmo_edge_copy(BMOperator *op,
BMOpSlot *slot_edgemap_out,
BMOpSlot *slot_boundarymap_out,
BMesh *bm_dst, BMesh *bm_src,
BMEdge *e_src,
GHash *vhash, GHash *ehash)
static BMEdge *bmo_edge_copy(
BMOperator *op,
BMOpSlot *slot_edgemap_out,
BMOpSlot *slot_boundarymap_out,
BMesh *bm_dst, BMesh *bm_src,
BMEdge *e_src,
GHash *vhash, GHash *ehash)
{
BMEdge *e_dst;
BMVert *e_dst_v1, *e_dst_v2;
@@ -131,11 +133,12 @@ static BMEdge *bmo_edge_copy(BMOperator *op,
*
* Copy an existing face from one bmesh to another.
*/
static BMFace *bmo_face_copy(BMOperator *op,
BMOpSlot *slot_facemap_out,
BMesh *bm_dst, BMesh *bm_src,
BMFace *f_src,
GHash *vhash, GHash *ehash)
static BMFace *bmo_face_copy(
BMOperator *op,
BMOpSlot *slot_facemap_out,
BMesh *bm_dst, BMesh *bm_src,
BMFace *f_src,
GHash *vhash, GHash *ehash)
{
BMFace *f_dst;
BMVert **vtar = BLI_array_alloca(vtar, f_src->len);

View File

@@ -61,8 +61,9 @@ static bool bm_loop_is_face_untag(BMElem *ele, void *UNUSED(user_data))
/**
* Copy all attributes from adjacent untagged faces.
*/
static void bm_face_copy_shared_all(BMesh *bm, BMLoop *l,
const bool use_normals, const bool use_data)
static void bm_face_copy_shared_all(
BMesh *bm, BMLoop *l,
const bool use_normals, const bool use_data)
{
BMLoop *l_other = l->radial_next;
BMFace *f = l->f, *f_other;
@@ -90,8 +91,9 @@ static void bm_face_copy_shared_all(BMesh *bm, BMLoop *l,
/**
* Flood fill attributes.
*/
static unsigned int bmesh_face_attribute_fill(BMesh *bm,
const bool use_normals, const bool use_data)
static unsigned int bmesh_face_attribute_fill(
BMesh *bm,
const bool use_normals, const bool use_data)
{
BLI_LINKSTACK_DECLARE(loop_queue_prev, BMLoop *);
BLI_LINKSTACK_DECLARE(loop_queue_next, BMLoop *);

View File

@@ -114,8 +114,9 @@ static void quad_verts_to_barycentric_tri(
/**
* Assign a loop pair from 2 verts (which _must_ share an edge)
*/
static void bm_loop_pair_from_verts(BMVert *v_a, BMVert *v_b,
BMLoop *l_pair[2])
static void bm_loop_pair_from_verts(
BMVert *v_a, BMVert *v_b,
BMLoop *l_pair[2])
{
BMEdge *e = BM_edge_exists(v_a, v_b);
if (e->l) {
@@ -185,8 +186,9 @@ static void bm_loop_interp_from_grid_boundary_2(BMesh *bm, BMLoop *l, BMLoop *l_
/**
* Avoids calling #barycentric_weights_v2_quad often by caching weights into an array.
*/
static void barycentric_weights_v2_grid_cache(const unsigned int xtot, const unsigned int ytot,
float (*weight_table)[4])
static void barycentric_weights_v2_grid_cache(
const unsigned int xtot, const unsigned int ytot,
float (*weight_table)[4])
{
float x_step = 1.0f / (float)(xtot - 1);
float y_step = 1.0f / (float)(ytot - 1);
@@ -216,9 +218,10 @@ static void barycentric_weights_v2_grid_cache(const unsigned int xtot, const uns
*
* \param v_grid 2d array of verts, all boundary verts must be set, we fill in the middle.
*/
static void bm_grid_fill_array(BMesh *bm, BMVert **v_grid, const unsigned int xtot, unsigned const int ytot,
const short mat_nr, const bool use_smooth,
const bool use_flip, const bool use_interp_simple)
static void bm_grid_fill_array(
BMesh *bm, BMVert **v_grid, const unsigned int xtot, unsigned const int ytot,
const short mat_nr, const bool use_smooth,
const bool use_flip, const bool use_interp_simple)
{
const bool use_vert_interp = CustomData_has_interp(&bm->vdata);
const bool use_loop_interp = CustomData_has_interp(&bm->ldata);
@@ -485,10 +488,11 @@ static void bm_grid_fill_array(BMesh *bm, BMVert **v_grid, const unsigned int xt
#undef XY
}
static void bm_grid_fill(BMesh *bm,
struct BMEdgeLoopStore *estore_a, struct BMEdgeLoopStore *estore_b,
struct BMEdgeLoopStore *estore_rail_a, struct BMEdgeLoopStore *estore_rail_b,
const short mat_nr, const bool use_smooth, const bool use_interp_simple)
static void bm_grid_fill(
BMesh *bm,
struct BMEdgeLoopStore *estore_a, struct BMEdgeLoopStore *estore_b,
struct BMEdgeLoopStore *estore_rail_a, struct BMEdgeLoopStore *estore_rail_b,
const short mat_nr, const bool use_smooth, const bool use_interp_simple)
{
#define USE_FLIP_DETECT

View File

@@ -67,8 +67,9 @@ typedef struct HullTriangle {
/*************************** Hull Triangles ***************************/
static void hull_add_triangle(BMesh *bm, GSet *hull_triangles, BLI_mempool *pool,
BMVert *v1, BMVert *v2, BMVert *v3)
static void hull_add_triangle(
BMesh *bm, GSet *hull_triangles, BLI_mempool *pool,
BMVert *v1, BMVert *v2, BMVert *v3)
{
HullTriangle *t;
int i;
@@ -189,8 +190,9 @@ static LinkData *final_edges_find_link(ListBase *adj, BMVert *v)
return NULL;
}
static int hull_final_edges_lookup(HullFinalEdges *final_edges,
BMVert *v1, BMVert *v2)
static int hull_final_edges_lookup(
HullFinalEdges *final_edges,
BMVert *v1, BMVert *v2)
{
ListBase *adj;
@@ -259,8 +261,9 @@ static void hull_final_edges_free(HullFinalEdges *final_edges)
/**************************** Final Output ****************************/
static void hull_remove_overlapping(BMesh *bm, GSet *hull_triangles,
HullFinalEdges *final_edges)
static void hull_remove_overlapping(
BMesh *bm, GSet *hull_triangles,
HullFinalEdges *final_edges)
{
GSetIterator hull_iter;
@@ -296,8 +299,9 @@ static void hull_remove_overlapping(BMesh *bm, GSet *hull_triangles,
}
}
static void hull_mark_interior_elements(BMesh *bm, BMOperator *op,
HullFinalEdges *final_edges)
static void hull_mark_interior_elements(
BMesh *bm, BMOperator *op,
HullFinalEdges *final_edges)
{
BMEdge *e;
BMFace *f;
@@ -425,8 +429,9 @@ static int hull_input_vert_count(BMOperator *op)
return count;
}
static BMVert **hull_input_verts_copy(BMOperator *op,
const int num_input_verts)
static BMVert **hull_input_verts_copy(
BMOperator *op,
const int num_input_verts)
{
BMOIter oiter;
BMVert *v;
@@ -441,8 +446,9 @@ static BMVert **hull_input_verts_copy(BMOperator *op,
return input_verts;
}
static float (*hull_verts_for_bullet(BMVert **input_verts,
const int num_input_verts))[3]
static float (*hull_verts_for_bullet(
BMVert **input_verts,
const int num_input_verts))[3]
{
float (*coords)[3] = MEM_callocN(sizeof(*coords) * num_input_verts, __func__);
int i;
@@ -454,9 +460,10 @@ static float (*hull_verts_for_bullet(BMVert **input_verts,
return coords;
}
static BMVert **hull_verts_from_bullet(plConvexHull hull,
BMVert **input_verts,
const int num_input_verts)
static BMVert **hull_verts_from_bullet(
plConvexHull hull,
BMVert **input_verts,
const int num_input_verts)
{
const int num_verts = plConvexHullNumVertices(hull);
BMVert **hull_verts = MEM_mallocN(sizeof(*hull_verts) *
@@ -478,9 +485,10 @@ static BMVert **hull_verts_from_bullet(plConvexHull hull,
return hull_verts;
}
static void hull_from_bullet(BMesh *bm, BMOperator *op,
GSet *hull_triangles,
BLI_mempool *pool)
static void hull_from_bullet(
BMesh *bm, BMOperator *op,
GSet *hull_triangles,
BLI_mempool *pool)
{
int *fvi = NULL;
BLI_array_declare(fvi);

View File

@@ -45,8 +45,9 @@
#define FACE_OUT (1 << 0)
/* assumes edges are validated before reaching this poin */
static float measure_facepair(const float v1[3], const float v2[3],
const float v3[3], const float v4[3], float limit)
static float measure_facepair(
const float v1[3], const float v2[3],
const float v3[3], const float v4[3], float limit)
{
/* gives a 'weight' to a pair of triangles that join an edge to decide how good a join they would make */
/* Note: this is more complicated than it needs to be and should be cleaned up.. */

View File

@@ -522,8 +522,9 @@ void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op)
}
static void bmesh_find_doubles_common(BMesh *bm, BMOperator *op,
BMOperator *optarget, BMOpSlot *optarget_slot)
static void bmesh_find_doubles_common(
BMesh *bm, BMOperator *op,
BMOperator *optarget, BMOpSlot *optarget_slot)
{
BMVert **verts;
int verts_len;

View File

@@ -80,8 +80,9 @@ static void bmo_subd_init_shape_info(BMesh *bm, SubDParams *params)
}
typedef void (*subd_pattern_fill_fp)(BMesh *bm, BMFace *face, BMVert **verts,
const SubDParams *params);
typedef void (*subd_pattern_fill_fp)(
BMesh *bm, BMFace *face, BMVert **verts,
const SubDParams *params);
/*
* note: this is a pattern-based edge subdivider.
@@ -1176,14 +1177,15 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
}
/* editmesh-emulating function */
void BM_mesh_esubdivide(BMesh *bm, const char edge_hflag,
const float smooth, const short smooth_falloff, const bool use_smooth_even,
const float fractal, const float along_normal,
const int numcuts,
const int seltype, const int cornertype,
const short use_single_edge, const short use_grid_fill,
const short use_only_quads,
const int seed)
void BM_mesh_esubdivide(
BMesh *bm, const char edge_hflag,
const float smooth, const short smooth_falloff, const bool use_smooth_even,
const float fractal, const float along_normal,
const int numcuts,
const int seltype, const int cornertype,
const short use_single_edge, const short use_grid_fill,
const short use_only_quads,
const int seed)
{
BMOperator op;

View File

@@ -80,8 +80,9 @@ static unsigned int bm_verts_tag_count(BMesh *bm)
}
#endif
static float bezier_handle_calc_length_v3(const float co_a[3], const float no_a[3],
const float co_b[3], const float no_b[3])
static float bezier_handle_calc_length_v3(
const float co_a[3], const float no_a[3],
const float co_b[3], const float no_b[3])
{
const float dot = dot_v3v3(no_a, no_b);
/* gives closest approx at a circle with 2 parallel handles */
@@ -538,12 +539,13 @@ static void bm_edgering_pair_store_free(
/* -------------------------------------------------------------------- */
/* Interpolation Function */
static void bm_edgering_pair_interpolate(BMesh *bm, LoopPairStore *lpair,
struct BMEdgeLoopStore *el_store_a,
struct BMEdgeLoopStore *el_store_b,
ListBase *eloops_ring,
const int interp_mode, const int cuts, const float smooth,
const float *falloff_cache)
static void bm_edgering_pair_interpolate(
BMesh *bm, LoopPairStore *lpair,
struct BMEdgeLoopStore *el_store_a,
struct BMEdgeLoopStore *el_store_b,
ListBase *eloops_ring,
const int interp_mode, const int cuts, const float smooth,
const float *falloff_cache)
{
const int resolu = cuts + 2;
const int dims = 3;
@@ -878,9 +880,10 @@ static bool bm_edgering_pair_order_is_flipped(BMesh *UNUSED(bm),
* Takes 2 edge loops that share edges,
* sort their verts and rotates the list so the lined up.
*/
static void bm_edgering_pair_order(BMesh *bm,
struct BMEdgeLoopStore *el_store_a,
struct BMEdgeLoopStore *el_store_b)
static void bm_edgering_pair_order(
BMesh *bm,
struct BMEdgeLoopStore *el_store_a,
struct BMEdgeLoopStore *el_store_b)
{
ListBase *lb_a = BM_edgeloop_verts_get(el_store_a);
ListBase *lb_b = BM_edgeloop_verts_get(el_store_b);
@@ -951,11 +954,12 @@ static void bm_edgering_pair_order(BMesh *bm,
*
* \note loops are _not_ aligned.
*/
static void bm_edgering_pair_subdiv(BMesh *bm,
struct BMEdgeLoopStore *el_store_a,
struct BMEdgeLoopStore *el_store_b,
ListBase *eloops_ring,
const int cuts)
static void bm_edgering_pair_subdiv(
BMesh *bm,
struct BMEdgeLoopStore *el_store_a,
struct BMEdgeLoopStore *el_store_b,
ListBase *eloops_ring,
const int cuts)
{
ListBase *lb_a = BM_edgeloop_verts_get(el_store_a);
// ListBase *lb_b = BM_edgeloop_verts_get(el_store_b);
@@ -1043,11 +1047,12 @@ static void bm_edgering_pair_subdiv(BMesh *bm,
bm_edgeloop_vert_tag(el_store_b, false);
}
static void bm_edgering_pair_ringsubd(BMesh *bm, LoopPairStore *lpair,
struct BMEdgeLoopStore *el_store_a,
struct BMEdgeLoopStore *el_store_b,
const int interp_mode, const int cuts, const float smooth,
const float *falloff_cache)
static void bm_edgering_pair_ringsubd(
BMesh *bm, LoopPairStore *lpair,
struct BMEdgeLoopStore *el_store_a,
struct BMEdgeLoopStore *el_store_b,
const int interp_mode, const int cuts, const float smooth,
const float *falloff_cache)
{
ListBase eloops_ring = {NULL};
bm_edgering_pair_order(bm, el_store_a, el_store_b);