diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/blenkernel/BKE_curve.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/blenkernel/BKE_curve.h')
-rw-r--r-- | source/blender/blenkernel/BKE_curve.h | 183 |
1 files changed, 114 insertions, 69 deletions
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index f6ceea0d9cc..4eaa0fbe057 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -39,38 +39,48 @@ struct TextBox; struct rctf; typedef struct CurveCache { - ListBase disp; - ListBase bev; - ListBase deformed_nurbs; - struct Path *path; + ListBase disp; + ListBase bev; + ListBase deformed_nurbs; + struct Path *path; } CurveCache; /* Definitions needed for shape keys */ typedef struct CVKeyIndex { - void *orig_cv; - int key_index, nu_index, pt_index, vertex_index; - bool switched; + void *orig_cv; + int key_index, nu_index, pt_index, vertex_index; + bool switched; } CVKeyIndex; -#define KNOTSU(nu) ( (nu)->orderu + (nu)->pntsu + (((nu)->flagu & CU_NURB_CYCLIC) ? ((nu)->orderu - 1) : 0) ) -#define KNOTSV(nu) ( (nu)->orderv + (nu)->pntsv + (((nu)->flagv & CU_NURB_CYCLIC) ? ((nu)->orderv - 1) : 0) ) +#define KNOTSU(nu) \ + ((nu)->orderu + (nu)->pntsu + (((nu)->flagu & CU_NURB_CYCLIC) ? ((nu)->orderu - 1) : 0)) +#define KNOTSV(nu) \ + ((nu)->orderv + (nu)->pntsv + (((nu)->flagv & CU_NURB_CYCLIC) ? ((nu)->orderv - 1) : 0)) /* Non cyclic nurbs have 1 less segment */ -#define SEGMENTSU(nu) ( ((nu)->flagu & CU_NURB_CYCLIC) ? (nu)->pntsu : (nu)->pntsu - 1) -#define SEGMENTSV(nu) ( ((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv - 1) +#define SEGMENTSU(nu) (((nu)->flagu & CU_NURB_CYCLIC) ? (nu)->pntsu : (nu)->pntsu - 1) +#define SEGMENTSV(nu) (((nu)->flagv & CU_NURB_CYCLIC) ? (nu)->pntsv : (nu)->pntsv - 1) #define CU_DO_TILT(cu, nu) ((((nu)->flag & CU_2D) && ((cu)->flag & CU_3D) == 0) ? 0 : 1) -#define CU_DO_RADIUS(cu, nu) ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1 != 0.0f || (cu)->ext2 != 0.0f) ? 1 : 0) +#define CU_DO_RADIUS(cu, nu) \ + ((CU_DO_TILT(cu, nu) || ((cu)->flag & CU_PATH_RADIUS) || (cu)->bevobj || (cu)->ext1 != 0.0f || \ + (cu)->ext2 != 0.0f) ? \ + 1 : \ + 0) /* not 3d and not unfilled */ -#define CU_DO_2DFILL(cu) ((((cu)->flag & CU_3D) == 0) && (((cu)->flag & (CU_FRONT | CU_BACK)) != 0)) +#define CU_DO_2DFILL(cu) \ + ((((cu)->flag & CU_3D) == 0) && (((cu)->flag & (CU_FRONT | CU_BACK)) != 0)) /* ** Curve ** */ void BKE_curve_free(struct Curve *cu); void BKE_curve_editfont_free(struct Curve *cu); void BKE_curve_init(struct Curve *cu); struct Curve *BKE_curve_add(struct Main *bmain, const char *name, int type); -void BKE_curve_copy_data(struct Main *bmain, struct Curve *cu_dst, const struct Curve *cu_src, const int flag); +void BKE_curve_copy_data(struct Main *bmain, + struct Curve *cu_dst, + const struct Curve *cu_src, + const int flag); struct Curve *BKE_curve_copy(struct Main *bmain, const struct Curve *cu); void BKE_curve_make_local(struct Main *bmain, struct Curve *cu, const bool lib_local); short BKE_curve_type_get(struct Curve *cu); @@ -80,28 +90,38 @@ void BKE_curve_curve_dimension_update(struct Curve *cu); void BKE_curve_boundbox_calc(struct Curve *cu, float r_loc[3], float r_size[3]); struct BoundBox *BKE_curve_boundbox_get(struct Object *ob); void BKE_curve_texspace_calc(struct Curve *cu); -struct BoundBox *BKE_curve_texspace_get(struct Curve *cu, float r_loc[3], float r_rot[3], float r_size[3]); +struct BoundBox *BKE_curve_texspace_get(struct Curve *cu, + float r_loc[3], + float r_rot[3], + float r_size[3]); bool BKE_curve_minmax(struct Curve *cu, bool use_radius, float min[3], float max[3]); bool BKE_curve_center_median(struct Curve *cu, float cent[3]); bool BKE_curve_center_bounds(struct Curve *cu, float cent[3]); -void BKE_curve_transform_ex(struct Curve *cu, float mat[4][4], const bool do_keys, const bool do_props, const float unit_scale); -void BKE_curve_transform(struct Curve *cu, float mat[4][4], const bool do_keys, const bool do_props); +void BKE_curve_transform_ex(struct Curve *cu, + float mat[4][4], + const bool do_keys, + const bool do_props, + const float unit_scale); +void BKE_curve_transform(struct Curve *cu, + float mat[4][4], + const bool do_keys, + const bool do_props); void BKE_curve_translate(struct Curve *cu, float offset[3], const bool do_keys); void BKE_curve_material_index_remove(struct Curve *cu, int index); void BKE_curve_material_index_clear(struct Curve *cu); bool BKE_curve_material_index_validate(struct Curve *cu); void BKE_curve_material_remap(struct Curve *cu, const unsigned int *remap, unsigned int remap_len); -ListBase *BKE_curve_nurbs_get(struct Curve *cu); +ListBase *BKE_curve_nurbs_get(struct Curve *cu); -int BKE_curve_nurb_vert_index_get(const struct Nurb *nu, const void *vert); -void BKE_curve_nurb_active_set(struct Curve *cu, const struct Nurb *nu); +int BKE_curve_nurb_vert_index_get(const struct Nurb *nu, const void *vert); +void BKE_curve_nurb_active_set(struct Curve *cu, const struct Nurb *nu); struct Nurb *BKE_curve_nurb_active_get(struct Curve *cu); -void *BKE_curve_vert_active_get(struct Curve *cu); -void BKE_curve_nurb_vert_active_set(struct Curve *cu, const struct Nurb *nu, const void *vert); -bool BKE_curve_nurb_vert_active_get(struct Curve *cu, struct Nurb **r_nu, void **r_vert); -void BKE_curve_nurb_vert_active_validate(struct Curve *cu); +void *BKE_curve_vert_active_get(struct Curve *cu); +void BKE_curve_nurb_vert_active_set(struct Curve *cu, const struct Nurb *nu, const void *vert); +bool BKE_curve_nurb_vert_active_get(struct Curve *cu, struct Nurb **r_nu, void **r_vert); +void BKE_curve_nurb_vert_active_validate(struct Curve *cu); float (*BKE_curve_nurbs_vertexCos_get(struct ListBase *lb, int *r_numVerts))[3]; void BK_curve_nurbs_vertexCos_apply(struct ListBase *lb, float (*vertexCos)[3]); @@ -114,20 +134,30 @@ void BKE_curve_editNurb_keyIndex_free(struct GHash **keyindex); void BKE_curve_editNurb_free(struct Curve *cu); struct ListBase *BKE_curve_editNurbs_get(struct Curve *cu); -float *BKE_curve_make_orco(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, int *r_numVerts); +float *BKE_curve_make_orco(struct Depsgraph *depsgraph, + struct Scene *scene, + struct Object *ob, + int *r_numVerts); float *BKE_curve_surf_make_orco(struct Object *ob); void BKE_curve_bevelList_free(struct ListBase *bev); void BKE_curve_bevelList_make(struct Object *ob, struct ListBase *nurbs, bool for_render); -void BKE_curve_bevel_make( - struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ListBase *disp, - const bool for_render, const bool use_render_resolution, - struct LinkNode *ob_cyclic_list); - -void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride); -void BKE_curve_forward_diff_tangent_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride); - -void BKE_curve_rect_from_textbox(const struct Curve *cu, const struct TextBox *tb, struct rctf *r_rect); +void BKE_curve_bevel_make(struct Depsgraph *depsgraph, + struct Scene *scene, + struct Object *ob, + struct ListBase *disp, + const bool for_render, + const bool use_render_resolution, + struct LinkNode *ob_cyclic_list); + +void BKE_curve_forward_diff_bezier( + float q0, float q1, float q2, float q3, float *p, int it, int stride); +void BKE_curve_forward_diff_tangent_bezier( + float q0, float q1, float q2, float q3, float *p, int it, int stride); + +void BKE_curve_rect_from_textbox(const struct Curve *cu, + const struct TextBox *tb, + struct rctf *r_rect); /* ** Nurbs ** */ @@ -139,7 +169,9 @@ int BKE_nurbList_verts_count_without_handles(struct ListBase *nurb); void BKE_nurbList_free(struct ListBase *lb); void BKE_nurbList_duplicate(struct ListBase *lb1, const struct ListBase *lb2); void BKE_nurbList_handles_set(struct ListBase *editnurb, const char code); -void BKE_nurbList_handles_recalculate(struct ListBase *editnurb, const bool calc_length, const char flag); +void BKE_nurbList_handles_recalculate(struct ListBase *editnurb, + const bool calc_length, + const char flag); void BKE_nurbList_handles_autocalc(ListBase *editnurb, int flag); void BKE_nurbList_flag_set(ListBase *editnurb, short flag); @@ -153,21 +185,28 @@ void BKE_nurb_minmax(struct Nurb *nu, bool use_radius, float min[3], float max[3 float BKE_nurb_calc_length(const struct Nurb *nu, int resolution); void BKE_nurb_makeFaces( - const struct Nurb *nu, float *coord_array, - int rowstride, int resolu, int resolv); -void BKE_nurb_makeCurve( - const struct Nurb *nu, float *coord_array, float *tilt_array, float *radius_array, float *weight_array, - int resolu, int stride); - -unsigned int BKE_curve_calc_coords_axis_len( - const unsigned int bezt_array_len, const unsigned int resolu, - const bool is_cyclic, const bool use_cyclic_duplicate_endpoint); -void BKE_curve_calc_coords_axis( - const struct BezTriple *bezt_array, const unsigned int bezt_array_len, const unsigned int resolu, - const bool is_cyclic, const bool use_cyclic_duplicate_endpoint, - /* array params */ - const unsigned int axis, const unsigned int stride, - float *r_points); + const struct Nurb *nu, float *coord_array, int rowstride, int resolu, int resolv); +void BKE_nurb_makeCurve(const struct Nurb *nu, + float *coord_array, + float *tilt_array, + float *radius_array, + float *weight_array, + int resolu, + int stride); + +unsigned int BKE_curve_calc_coords_axis_len(const unsigned int bezt_array_len, + const unsigned int resolu, + const bool is_cyclic, + const bool use_cyclic_duplicate_endpoint); +void BKE_curve_calc_coords_axis(const struct BezTriple *bezt_array, + const unsigned int bezt_array_len, + const unsigned int resolu, + const bool is_cyclic, + const bool use_cyclic_duplicate_endpoint, + /* array params */ + const unsigned int axis, + const unsigned int stride, + float *r_points); void BKE_nurb_knot_calc_u(struct Nurb *nu); void BKE_nurb_knot_calc_v(struct Nurb *nu); @@ -186,13 +225,13 @@ bool BKE_nurb_type_convert(struct Nurb *nu, const short type, const bool use_han void BKE_nurb_points_add(struct Nurb *nu, int number); void BKE_nurb_bezierPoints_add(struct Nurb *nu, int number); -int BKE_nurb_index_from_uv(struct Nurb *nu, int u, int v); +int BKE_nurb_index_from_uv(struct Nurb *nu, int u, int v); void BKE_nurb_index_to_uv(struct Nurb *nu, int index, int *r_u, int *r_v); struct BezTriple *BKE_nurb_bezt_get_next(struct Nurb *nu, struct BezTriple *bezt); struct BezTriple *BKE_nurb_bezt_get_prev(struct Nurb *nu, struct BezTriple *bezt); -struct BPoint *BKE_nurb_bpoint_get_next(struct Nurb *nu, struct BPoint *bp); -struct BPoint *BKE_nurb_bpoint_get_prev(struct Nurb *nu, struct BPoint *bp); +struct BPoint *BKE_nurb_bpoint_get_next(struct Nurb *nu, struct BPoint *bp); +struct BPoint *BKE_nurb_bpoint_get_prev(struct Nurb *nu, struct BPoint *bp); void BKE_nurb_bezt_calc_normal(struct Nurb *nu, struct BezTriple *bezt, float r_normal[3]); void BKE_nurb_bezt_calc_plane(struct Nurb *nu, struct BezTriple *bezt, float r_plane[3]); @@ -200,8 +239,11 @@ void BKE_nurb_bezt_calc_plane(struct Nurb *nu, struct BezTriple *bezt, float r_p void BKE_nurb_bpoint_calc_normal(struct Nurb *nu, struct BPoint *bp, float r_normal[3]); void BKE_nurb_bpoint_calc_plane(struct Nurb *nu, struct BPoint *bp, float r_plane[3]); -void BKE_nurb_handle_calc(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, - const bool is_fcurve, const char smoothing); +void BKE_nurb_handle_calc(struct BezTriple *bezt, + struct BezTriple *prev, + struct BezTriple *next, + const bool is_fcurve, + const char smoothing); void BKE_nurb_handle_calc_simple(struct Nurb *nu, struct BezTriple *bezt); void BKE_nurb_handle_calc_simple_auto(struct Nurb *nu, struct BezTriple *bezt); @@ -214,29 +256,32 @@ void BKE_nurb_handles_test(struct Nurb *nu, const bool use_handles); /* **** Depsgraph evaluation **** */ -void BKE_curve_eval_geometry( - struct Depsgraph *depsgraph, - struct Curve *curve); +void BKE_curve_eval_geometry(struct Depsgraph *depsgraph, struct Curve *curve); /* Draw Cache */ enum { - BKE_CURVE_BATCH_DIRTY_ALL = 0, - BKE_CURVE_BATCH_DIRTY_SELECT, + BKE_CURVE_BATCH_DIRTY_ALL = 0, + BKE_CURVE_BATCH_DIRTY_SELECT, }; void BKE_curve_batch_cache_dirty_tag(struct Curve *cu, int mode); void BKE_curve_batch_cache_free(struct Curve *cu); /* curve_decimate.c */ -unsigned int BKE_curve_decimate_bezt_array( - struct BezTriple *bezt_array, const unsigned int bezt_array_len, const unsigned int resolu, const bool is_cyclic, - const char flag_test, const char flag_set, - const float error_sq_max, const unsigned int error_target_len); - -void BKE_curve_decimate_nurb( - struct Nurb *nu, const unsigned int resolu, - const float error_sq_max, const unsigned int error_target_len); +unsigned int BKE_curve_decimate_bezt_array(struct BezTriple *bezt_array, + const unsigned int bezt_array_len, + const unsigned int resolu, + const bool is_cyclic, + const char flag_test, + const char flag_set, + const float error_sq_max, + const unsigned int error_target_len); + +void BKE_curve_decimate_nurb(struct Nurb *nu, + const unsigned int resolu, + const float error_sq_max, + const unsigned int error_target_len); extern void (*BKE_curve_batch_cache_dirty_tag_cb)(struct Curve *cu, int mode); extern void (*BKE_curve_batch_cache_free_cb)(struct Curve *cu); -#endif /* __BKE_CURVE_H__ */ +#endif /* __BKE_CURVE_H__ */ |