diff options
Diffstat (limited to 'source/blender/blenlib')
46 files changed, 462 insertions, 607 deletions
diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index 5b15bb979f5..85fa07d8563 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -53,9 +53,9 @@ */ void _bli_array_grow_func(void **arr_p, const void *arr_static, - const int sizeof_arr_p, - const int arr_len, - const int num, + int sizeof_arr_p, + int arr_len, + int num, const char *alloc_str); /* -------------------------------------------------------------------- */ diff --git a/source/blender/blenlib/BLI_array_store_utils.h b/source/blender/blenlib/BLI_array_store_utils.h index 771f4f962a7..01d7f8804ab 100644 --- a/source/blender/blenlib/BLI_array_store_utils.h +++ b/source/blender/blenlib/BLI_array_store_utils.h @@ -32,10 +32,10 @@ struct BArrayStore_AtSize { }; BArrayStore *BLI_array_store_at_size_ensure(struct BArrayStore_AtSize *bs_stride, - const int stride, - const int chunk_size); + int stride, + int chunk_size); -BArrayStore *BLI_array_store_at_size_get(struct BArrayStore_AtSize *bs_stride, const int stride); +BArrayStore *BLI_array_store_at_size_get(struct BArrayStore_AtSize *bs_stride, int stride); void BLI_array_store_at_size_clear(struct BArrayStore_AtSize *bs_stride); diff --git a/source/blender/blenlib/BLI_array_utils.h b/source/blender/blenlib/BLI_array_utils.h index eb14b030bf9..50fc2ce909b 100644 --- a/source/blender/blenlib/BLI_array_utils.h +++ b/source/blender/blenlib/BLI_array_utils.h @@ -52,7 +52,7 @@ void _bli_array_wrap(void *arr, uint arr_len, size_t arr_stride, int dir); * Access via #BLI_array_wrap */ void _bli_array_permute( - void *arr, const uint arr_len, const size_t arr_stride, const uint *order, void *arr_temp); + void *arr, uint arr_len, const size_t arr_stride, const uint *order, void *arr_temp); #define BLI_array_permute(arr, arr_len, order) \ _bli_array_permute(arr, arr_len, sizeof(*(arr)), order, NULL) #define BLI_array_permute_ex(arr, arr_len, order, arr_temp) \ diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h index e32a19cfc25..ad5e2b29766 100644 --- a/source/blender/blenlib/BLI_assert.h +++ b/source/blender/blenlib/BLI_assert.h @@ -31,11 +31,11 @@ extern "C" { /* Utility functions. */ -void _BLI_assert_print_pos(const char *file, const int line, const char *function, const char *id); +void _BLI_assert_print_pos(const char *file, int line, const char *function, const char *id); void _BLI_assert_print_extra(const char *str); void _BLI_assert_print_backtrace(void); void _BLI_assert_abort(void); -void _BLI_assert_unreachable_print(const char *file, const int line, const char *function); +void _BLI_assert_unreachable_print(const char *file, int line, const char *function); #ifdef _MSC_VER # include <crtdbg.h> /* for _STATIC_ASSERT */ diff --git a/source/blender/blenlib/BLI_astar.h b/source/blender/blenlib/BLI_astar.h index a1d4e28dad9..26b45f1ebe6 100644 --- a/source/blender/blenlib/BLI_astar.h +++ b/source/blender/blenlib/BLI_astar.h @@ -82,7 +82,7 @@ typedef struct BLI_AStarGraph { * \param custom_data: an opaque pointer attached to this link, * available e.g. to cost callback function. */ -void BLI_astar_node_init(BLI_AStarGraph *as_graph, const int node_index, void *custom_data); +void BLI_astar_node_init(BLI_AStarGraph *as_graph, int node_index, void *custom_data); /** * Add a link between two nodes of our A* graph. * @@ -91,15 +91,12 @@ void BLI_astar_node_init(BLI_AStarGraph *as_graph, const int node_index, void *c * \param custom_data: An opaque pointer attached to this link, * available e.g. to cost callback function. */ -void BLI_astar_node_link_add(BLI_AStarGraph *as_graph, - const int node1_index, - const int node2_index, - const float cost, - void *custom_data); +void BLI_astar_node_link_add( + BLI_AStarGraph *as_graph, int node1_index, int node2_index, float cost, void *custom_data); /** * \return The index of the other node of given link. */ -int BLI_astar_node_link_other_node(BLI_AStarGNLink *lnk, const int idx); +int BLI_astar_node_link_other_node(BLI_AStarGNLink *lnk, int idx); /** * Initialize a solution data for given A* graph. Does not compute anything! @@ -138,9 +135,9 @@ void BLI_astar_solution_free(BLI_AStarSolution *as_solution); typedef float (*astar_f_cost)(BLI_AStarGraph *as_graph, BLI_AStarSolution *as_solution, BLI_AStarGNLink *link, - const int node_idx_curr, - const int node_idx_next, - const int node_idx_dst); + int node_idx_curr, + int node_idx_next, + int node_idx_dst); /** * Initialize an A* graph. Total number of nodes must be known. @@ -150,7 +147,7 @@ typedef float (*astar_f_cost)(BLI_AStarGraph *as_graph, * \param custom_data: an opaque pointer attached to this link, * available e.g. to cost callback function. */ -void BLI_astar_graph_init(BLI_AStarGraph *as_graph, const int node_num, void *custom_data); +void BLI_astar_graph_init(BLI_AStarGraph *as_graph, int node_num, void *custom_data); void BLI_astar_graph_free(BLI_AStarGraph *as_graph); /** * Solve a path in given graph, using given 'cost' callback function. @@ -161,11 +158,11 @@ void BLI_astar_graph_free(BLI_AStarGraph *as_graph); * \return true if a path was found, false otherwise. */ bool BLI_astar_graph_solve(BLI_AStarGraph *as_graph, - const int node_index_src, - const int node_index_dst, + int node_index_src, + int node_index_dst, astar_f_cost f_cost_cb, BLI_AStarSolution *r_solution, - const int max_steps); + int max_steps); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_bitmap_draw_2d.h b/source/blender/blenlib/BLI_bitmap_draw_2d.h index 1b9ff2162e3..3831ed3c9e7 100644 --- a/source/blender/blenlib/BLI_bitmap_draw_2d.h +++ b/source/blender/blenlib/BLI_bitmap_draw_2d.h @@ -55,12 +55,12 @@ void BLI_bitmap_draw_2d_tri_v2i(const int p1[2], * } while (++x != x_end); * \endcode */ -void BLI_bitmap_draw_2d_poly_v2i_n(const int xmin, - const int ymin, - const int xmax, - const int ymax, +void BLI_bitmap_draw_2d_poly_v2i_n(int xmin, + int ymin, + int xmax, + int ymax, const int verts[][2], - const int verts_len, + int verts_len, void (*callback)(int x, int x_end, int y, void *), void *user_data); diff --git a/source/blender/blenlib/BLI_boxpack_2d.h b/source/blender/blenlib/BLI_boxpack_2d.h index e743424db59..eee1a0d3d41 100644 --- a/source/blender/blenlib/BLI_boxpack_2d.h +++ b/source/blender/blenlib/BLI_boxpack_2d.h @@ -58,7 +58,7 @@ typedef struct BoxPack { * \param len: the number of boxes in the array. * \param r_tot_x, r_tot_y: set so you can normalize the data. */ -void BLI_box_pack_2d(BoxPack *boxarray, const unsigned int len, float *r_tot_x, float *r_tot_y); +void BLI_box_pack_2d(BoxPack *boxarray, unsigned int len, float *r_tot_x, float *r_tot_y); typedef struct FixedSizeBoxPack { struct FixedSizeBoxPack *next, *prev; diff --git a/source/blender/blenlib/BLI_convexhull_2d.h b/source/blender/blenlib/BLI_convexhull_2d.h index 44758fb3880..77f3eedec95 100644 --- a/source/blender/blenlib/BLI_convexhull_2d.h +++ b/source/blender/blenlib/BLI_convexhull_2d.h @@ -32,7 +32,7 @@ extern "C" { * \param r_points: An array of the convex hull vertex indices (max is n). * \returns the number of points in r_points. */ -int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r_points[]); +int BLI_convexhull_2d_sorted(const float (*points)[2], int n, int r_points[]); /** * A.M. Andrew's monotone chain 2D convex hull algorithm. * @@ -43,7 +43,7 @@ int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r_points * even though the final result will be no more than \a n in size. * \returns the number of points in r_points. */ -int BLI_convexhull_2d(const float (*points)[2], const int n, int r_points[]); +int BLI_convexhull_2d(const float (*points)[2], int n, int r_points[]); /** * \return The best angle for fitting the convex hull to an axis aligned bounding box. diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h index b0f71655c19..26eb8ab7665 100644 --- a/source/blender/blenlib/BLI_edgehash.h +++ b/source/blender/blenlib/BLI_edgehash.h @@ -54,7 +54,7 @@ enum { EDGEHASH_FLAG_ALLOW_DUPES = (1 << 0), }; -EdgeHash *BLI_edgehash_new_ex(const char *info, const unsigned int nentries_reserve); +EdgeHash *BLI_edgehash_new_ex(const char *info, unsigned int nentries_reserve); EdgeHash *BLI_edgehash_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP free_value); void BLI_edgehash_print(EdgeHash *eh); @@ -138,7 +138,7 @@ int BLI_edgehash_len(const EdgeHash *eh) ATTR_WARN_UNUSED_RESULT; /** * Remove all edges from hash. */ -void BLI_edgehash_clear_ex(EdgeHash *eh, EdgeHashFreeFP free_value, const uint reserve); +void BLI_edgehash_clear_ex(EdgeHash *eh, EdgeHashFreeFP free_value, uint reserve); /** * Wraps #BLI_edgehash_clear_ex with zero entries reserved. */ @@ -207,8 +207,8 @@ typedef struct EdgeSetIterator { uint index; } EdgeSetIterator; -EdgeSet *BLI_edgeset_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +EdgeSet *BLI_edgeset_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; EdgeSet *BLI_edgeset_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; int BLI_edgeset_len(const EdgeSet *es) ATTR_WARN_UNUSED_RESULT; /** diff --git a/source/blender/blenlib/BLI_endian_switch.h b/source/blender/blenlib/BLI_endian_switch.h index e6ccbe4629a..c8257483616 100644 --- a/source/blender/blenlib/BLI_endian_switch.h +++ b/source/blender/blenlib/BLI_endian_switch.h @@ -42,14 +42,14 @@ BLI_INLINE void BLI_endian_switch_double(double *val) ATTR_NONNULL(1); /* endian_switch.c */ -void BLI_endian_switch_int16_array(short *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_uint16_array(unsigned short *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_int32_array(int *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_uint32_array(unsigned int *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_float_array(float *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_int64_array(int64_t *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_uint64_array(uint64_t *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_double_array(double *val, const int size) ATTR_NONNULL(1); +void BLI_endian_switch_int16_array(short *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_uint16_array(unsigned short *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_int32_array(int *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_uint32_array(unsigned int *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_float_array(float *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_int64_array(int64_t *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_uint64_array(uint64_t *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_double_array(double *val, int size) ATTR_NONNULL(1); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 2ef9b8f6c36..0022823b3de 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -181,7 +181,7 @@ void BLI_filelist_entry_duplicate(struct direntry *dst, const struct direntry *s */ void BLI_filelist_duplicate(struct direntry **dest_filelist, struct direntry *const src_filelist, - const unsigned int nrentries); + unsigned int nrentries); /** * Frees storage for a single direntry, not the direntry itself. */ @@ -189,20 +189,20 @@ void BLI_filelist_entry_free(struct direntry *entry); /** * Frees storage for an array of #direntry, including the array itself. */ -void BLI_filelist_free(struct direntry *filelist, const unsigned int nrentries); +void BLI_filelist_free(struct direntry *filelist, unsigned int nrentries); /** * Convert given entry's size into human-readable strings. */ void BLI_filelist_entry_size_to_string(const struct stat *st, - const uint64_t sz, - const bool compact, + uint64_t sz, + bool compact, char r_size[FILELIST_DIRENTRY_SIZE_LEN]); /** * Convert given entry's modes into human-readable strings. */ void BLI_filelist_entry_mode_to_string(const struct stat *st, - const bool compact, + bool compact, char r_mode1[FILELIST_DIRENTRY_MODE_LEN], char r_mode2[FILELIST_DIRENTRY_MODE_LEN], char r_mode3[FILELIST_DIRENTRY_MODE_LEN]); @@ -210,7 +210,7 @@ void BLI_filelist_entry_mode_to_string(const struct stat *st, * Convert given entry's owner into human-readable strings. */ void BLI_filelist_entry_owner_to_string(const struct stat *st, - const bool compact, + bool compact, char r_owner[FILELIST_DIRENTRY_OWNER_LEN]); /** * Convert given entry's time into human-readable strings. @@ -219,8 +219,8 @@ void BLI_filelist_entry_owner_to_string(const struct stat *st, * \param r_is_yesterday: optional, returns true if the date matches yesterday's. */ void BLI_filelist_entry_datetime_to_string(const struct stat *st, - const int64_t ts, - const bool compact, + int64_t ts, + bool compact, char r_time[FILELIST_DIRENTRY_TIME_LEN], char r_date[FILELIST_DIRENTRY_DATE_LEN], bool *r_is_today, diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index fca705535a3..1c5adb8ee82 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -99,7 +99,7 @@ enum { GHash *BLI_ghash_new_ex(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info, - const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; /** * Wraps #BLI_ghash_new_ex with zero entries reserved. */ @@ -124,7 +124,7 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef /** * Reserve given amount of entries (resize \a gh accordingly if needed). */ -void BLI_ghash_reserve(GHash *gh, const unsigned int nentries_reserve); +void BLI_ghash_reserve(GHash *gh, unsigned int nentries_reserve); /** * Insert a key/value pair into the \a gh. * @@ -226,7 +226,7 @@ void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfree void BLI_ghash_clear_ex(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp, - const unsigned int nentries_reserve); + unsigned int nentries_reserve); /** * Remove \a key from \a gh, returning the value or NULL if the key wasn't found. * @@ -372,7 +372,7 @@ typedef GHashIterState GSetIterState; GSet *BLI_gset_new_ex(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info, - const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; @@ -428,7 +428,7 @@ bool BLI_gset_haskey(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT; bool BLI_gset_pop(GSet *gs, GSetIterState *state, void **r_key) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp); -void BLI_gset_clear_ex(GSet *gs, GSetKeyFreeFP keyfreefp, const unsigned int nentries_reserve); +void BLI_gset_clear_ex(GSet *gs, GSetKeyFreeFP keyfreefp, unsigned int nentries_reserve); void BLI_gset_clear(GSet *gs, GSetKeyFreeFP keyfreefp); /* When set's are used for key & value. */ @@ -630,30 +630,30 @@ void BLI_ghashutil_pairfree(void *ptr); * Wrapper GHash Creation Functions */ -GHash *BLI_ghash_ptr_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +GHash *BLI_ghash_ptr_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GHash *BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; -GHash *BLI_ghash_str_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +GHash *BLI_ghash_str_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GHash *BLI_ghash_str_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; -GHash *BLI_ghash_int_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +GHash *BLI_ghash_int_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GHash *BLI_ghash_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; -GHash *BLI_ghash_pair_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +GHash *BLI_ghash_pair_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GHash *BLI_ghash_pair_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_ptr_new_ex(const char *info, - const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_ptr_new(const char *info); GSet *BLI_gset_str_new_ex(const char *info, - const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_str_new(const char *info); -GSet *BLI_gset_pair_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +GSet *BLI_gset_pair_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_pair_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_int_new_ex(const char *info, - const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; /** \} */ diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index 2f41be369c1..cee9ec4c0a8 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -137,7 +137,7 @@ typedef void (*BVHTree_NearestProjectedCallback)(void *userdata, int index, const struct DistProjectedAABBPrecalc *precalc, const float (*clip_plane)[4], - const int clip_plane_len, + int clip_plane_len, BVHTreeNearest *nearest); /* callbacks to BLI_bvhtree_walk_dfs */ @@ -200,8 +200,8 @@ BVHTreeOverlap *BLI_bvhtree_overlap_ex(const BVHTree *tree1, uint *r_overlap_tot, BVHTree_OverlapCallback callback, void *userdata, - const uint max_interactions, - const int flag); + uint max_interactions, + int flag); BVHTreeOverlap *BLI_bvhtree_overlap(const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_tot, @@ -248,7 +248,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, */ int BLI_bvhtree_find_nearest_first(BVHTree *tree, const float co[3], - const float dist_sq, + float dist_sq, BVHTree_NearestPointCallback callback, void *userdata); diff --git a/source/blender/blenlib/BLI_kdtree_impl.h b/source/blender/blenlib/BLI_kdtree_impl.h index 35dbf141c92..b15ae4a8a24 100644 --- a/source/blender/blenlib/BLI_kdtree_impl.h +++ b/source/blender/blenlib/BLI_kdtree_impl.h @@ -47,12 +47,12 @@ int BLI_kdtree_nd_(find_nearest)(const KDTree *tree, int BLI_kdtree_nd_(find_nearest_n)(const KDTree *tree, const float co[KD_DIMS], KDTreeNearest *r_nearest, - const uint nearest_len_capacity) ATTR_NONNULL(1, 2, 3); + uint nearest_len_capacity) ATTR_NONNULL(1, 2, 3); int BLI_kdtree_nd_(range_search)(const KDTree *tree, const float co[KD_DIMS], KDTreeNearest **r_nearest, - const float range) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT; + float range) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT; int BLI_kdtree_nd_(find_nearest_cb)( const KDTree *tree, @@ -68,7 +68,7 @@ void BLI_kdtree_nd_(range_search_cb)( void *user_data); int BLI_kdtree_nd_(calc_duplicates_fast)(const KDTree *tree, - const float range, + float range, bool use_index_order, int *doubles); @@ -79,7 +79,7 @@ int BLI_kdtree_nd_(find_nearest_n_with_len_squared_cb)( const KDTree *tree, const float co[KD_DIMS], KDTreeNearest *r_nearest, - const uint nearest_len_capacity, + uint nearest_len_capacity, float (*len_sq_fn)(const float co_search[KD_DIMS], const float co_test[KD_DIMS], const void *user_data), @@ -88,7 +88,7 @@ int BLI_kdtree_nd_(range_search_with_len_squared_cb)( const KDTree *tree, const float co[KD_DIMS], KDTreeNearest **r_nearest, - const float range, + float range, float (*len_sq_fn)(const float co_search[KD_DIMS], const float co_test[KD_DIMS], const void *user_data), diff --git a/source/blender/blenlib/BLI_lasso_2d.h b/source/blender/blenlib/BLI_lasso_2d.h index 5f034bfdc1d..2e4a2ed22b4 100644 --- a/source/blender/blenlib/BLI_lasso_2d.h +++ b/source/blender/blenlib/BLI_lasso_2d.h @@ -29,22 +29,19 @@ extern "C" { struct rcti; -void BLI_lasso_boundbox(struct rcti *rect, const int mcoords[][2], const unsigned int mcoords_len); -bool BLI_lasso_is_point_inside(const int mcoords[][2], - const unsigned int mcoords_len, - const int sx, - const int sy, - const int error_value); +void BLI_lasso_boundbox(struct rcti *rect, const int mcoords[][2], unsigned int mcoords_len); +bool BLI_lasso_is_point_inside( + const int mcoords[][2], unsigned int mcoords_len, int sx, int sy, int error_value); /** * Edge version for lasso select. We assume bound-box check was done. */ bool BLI_lasso_is_edge_inside(const int mcoords[][2], - const unsigned int mcoords_len, + unsigned int mcoords_len, int x0, int y0, int x1, int y1, - const int error_value); + int error_value); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index a2a6e958213..64852b95ae4 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -44,7 +44,7 @@ int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_ */ int BLI_findstringindex(const struct ListBase *listbase, const char *id, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Return a ListBase representing the entire list the given Link is in. @@ -64,21 +64,21 @@ void *BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED */ void *BLI_findstring(const struct ListBase *listbase, const char *id, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the first element of \a listbase which contains a pointer to the * null-terminated string \a id at the specified offset, returning NULL if not found. */ void *BLI_findstring_ptr(const struct ListBase *listbase, const char *id, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the first element of listbase which contains the specified pointer value * at the specified offset, returning NULL if not found. */ void *BLI_findptr(const struct ListBase *listbase, const void *ptr, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the first element of listbase which contains the specified bytes * at the specified offset, returning NULL if not found. @@ -86,7 +86,7 @@ void *BLI_findptr(const struct ListBase *listbase, void *BLI_listbase_bytes_find(const ListBase *listbase, const void *bytes, const size_t bytes_size, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); /** * Find the first item in the list that matches the given string, or the given index as fallback. * @@ -97,7 +97,7 @@ void *BLI_listbase_bytes_find(const ListBase *listbase, void *BLI_listbase_string_or_index_find(const struct ListBase *listbase, const char *string, const size_t string_offset, - const int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /* Find backwards. */ @@ -112,21 +112,21 @@ void *BLI_rfindlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSE */ void *BLI_rfindstring(const struct ListBase *listbase, const char *id, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the last element of \a listbase which contains a pointer to the * null-terminated string \a id at the specified offset, returning NULL if not found. */ void *BLI_rfindstring_ptr(const struct ListBase *listbase, const char *id, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the last element of listbase which contains the specified pointer value * at the specified offset, returning NULL if not found. */ void *BLI_rfindptr(const struct ListBase *listbase, const void *ptr, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the last element of listbase which contains the specified bytes * at the specified offset, returning NULL if not found. @@ -134,7 +134,7 @@ void *BLI_rfindptr(const struct ListBase *listbase, void *BLI_listbase_bytes_rfind(const ListBase *listbase, const void *bytes, const size_t bytes_size, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); /** * Removes and disposes of the entire contents of \a listbase using guardedalloc. @@ -221,7 +221,7 @@ void BLI_freelist(struct ListBase *listbase) ATTR_NONNULL(1); * \note Use to avoid redundant looping. */ int BLI_listbase_count_at_most(const struct ListBase *listbase, - const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Returns the number of elements in \a listbase. */ diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 6c82bd89e64..f6462233106 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -183,7 +183,7 @@ MINLINE size_t clamp_z(size_t value, size_t min, size_t max); * * \param max_diff: the maximum absolute difference. */ -MINLINE int compare_ff(float a, float b, const float max_diff); +MINLINE int compare_ff(float a, float b, float max_diff); /** * Almost-equal for IEEE floats, using their integer representation * (mixing ULP and absolute difference methods). @@ -195,10 +195,8 @@ MINLINE int compare_ff(float a, float b, const float max_diff); * * \see https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ */ -MINLINE int compare_ff_relative(float a, float b, const float max_diff, const int max_ulps); -MINLINE bool compare_threshold_relative(const float value1, - const float value2, - const float thresh); +MINLINE int compare_ff_relative(float a, float b, float max_diff, int max_ulps); +MINLINE bool compare_threshold_relative(float value1, float value2, float thresh); MINLINE float signf(float f); MINLINE int signum_i_ex(float a, float eps); @@ -213,13 +211,13 @@ MINLINE float power_of_2(float f); * Returns number of (base ten) *significant* digits of integer part of given float * (negative in case of decimal-only floats, 0.01 returns -1 e.g.). */ -MINLINE int integer_digits_f(const float f); +MINLINE int integer_digits_f(float f); /** * Returns number of (base ten) *significant* digits of integer part of given double * (negative in case of decimal-only floats, 0.01 returns -1 e.g.). */ -MINLINE int integer_digits_d(const double d); -MINLINE int integer_digits_i(const int i); +MINLINE int integer_digits_d(double d); +MINLINE int integer_digits_i(int i); /* These don't really fit anywhere but were being copied about a lot. */ diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 32424f37676..0798acbb790 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -107,7 +107,7 @@ MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4]); MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4]); MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4]); -MINLINE unsigned short to_srgb_table_lookup(const float f); +MINLINE unsigned short to_srgb_table_lookup(float f); MINLINE void linearrgb_to_srgb_ushort4(unsigned short srgb[4], const float linear[4]); MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4]); MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4]); @@ -182,7 +182,7 @@ void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4]); MINLINE float rgb_to_grayscale(const float rgb[3]); MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3]); -MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3], const int limit); +MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3], int limit); /** * Return triangle noise in [-0.5..1.5] range. @@ -197,19 +197,12 @@ MINLINE void float_to_byte_dither_v3( #define rgba_float_args_set_ch(col, r, g, b, a) \ rgba_float_args_set(col, (r) / 255.0f, (g) / 255.0f, (b) / 255.0f, (a) / 255.0f) -MINLINE void rgba_uchar_args_set(unsigned char col[4], - const unsigned char r, - const unsigned char g, - const unsigned char b, - const unsigned char a); -MINLINE void rgba_float_args_set( - float col[4], const float r, const float g, const float b, const float a); -MINLINE void rgba_uchar_args_test_set(unsigned char col[4], - const unsigned char r, - const unsigned char g, - const unsigned char b, - const unsigned char a); -MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack); +MINLINE void rgba_uchar_args_set( + unsigned char col[4], unsigned char r, unsigned char g, unsigned char b, unsigned char a); +MINLINE void rgba_float_args_set(float col[4], float r, float g, float b, float a); +MINLINE void rgba_uchar_args_test_set( + unsigned char col[4], unsigned char r, unsigned char g, unsigned char b, unsigned char a); +MINLINE void cpack_cpy_3ub(unsigned char r_col[3], unsigned int pack); void blackbody_temperature_to_rgb_table(float *r_table, int width, float min, float max); void wavelength_to_xyz_table(float *r_table, int width); diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index c2a5ffafa64..6d7159f73c6 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -372,8 +372,8 @@ void closest_on_tri_to_point_v3( float ray_point_factor_v3_ex(const float p[3], const float ray_origin[3], const float ray_direction[3], - const float epsilon, - const float fallback); + float epsilon, + float fallback); float ray_point_factor_v3(const float p[3], const float ray_origin[3], const float ray_direction[3]); @@ -385,18 +385,12 @@ float ray_point_factor_v3(const float p[3], * \param epsilon: avoid approaching divide-by-zero. * Passing a zero will just check for nonzero division. */ -float line_point_factor_v3_ex(const float p[3], - const float l1[3], - const float l2[3], - const float epsilon, - const float fallback); +float line_point_factor_v3_ex( + const float p[3], const float l1[3], const float l2[3], float epsilon, float fallback); float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3]); -float line_point_factor_v2_ex(const float p[2], - const float l1[2], - const float l2[2], - const float epsilon, - const float fallback); +float line_point_factor_v2_ex( + const float p[2], const float l1[2], const float l2[2], float epsilon, float fallback); float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2]); /** @@ -411,7 +405,7 @@ float line_plane_factor_v3(const float plane_co[3], * Ensure the distance between these points is no greater than 'dist'. * If it is, scale them both into the center. */ -void limit_dist_v3(float v1[3], float v2[3], const float dist); +void limit_dist_v3(float v1[3], float v2[3], float dist); /** \} */ @@ -462,7 +456,7 @@ int isect_seg_seg_v2_point_ex(const float v0[2], const float v1[2], const float v2[2], const float v3[2], - const float endpoint_bias, + float endpoint_bias, float vi[2]); int isect_seg_seg_v2_point( const float v0[2], const float v1[2], const float v2[2], const float v3[2], float vi[2]); @@ -504,13 +498,13 @@ int isect_seg_seg_v2_lambda_mu_db(const double v1[2], int isect_line_sphere_v3(const float l1[3], const float l2[3], const float sp[3], - const float r, + float r, float r_p1[3], float r_p2[3]); int isect_line_sphere_v2(const float l1[2], const float l2[2], const float sp[2], - const float r, + float r, float r_p1[2], float r_p2[2]); @@ -531,7 +525,7 @@ int isect_line_line_epsilon_v3(const float v1[3], const float v4[3], float i1[3], float i2[3], - const float epsilon); + float epsilon); int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3], @@ -558,7 +552,7 @@ bool isect_ray_ray_epsilon_v3(const float ray_origin_a[3], const float ray_direction_a[3], const float ray_origin_b[3], const float ray_direction_b[3], - const float epsilon, + float epsilon, float *r_lambda_a, float *r_lambda_b); bool isect_ray_ray_v3(const float ray_origin_a[3], @@ -578,7 +572,7 @@ bool isect_ray_plane_v3(const float ray_origin[3], const float ray_direction[3], const float plane[4], float *r_lambda, - const bool clip); + bool clip); /** * Check if a point is behind all planes. @@ -588,7 +582,7 @@ bool isect_point_planes_v3(float (*planes)[4], int totplane, const float p[3]); * Check if a point is in front all planes. * Same as isect_point_planes_v3 but with planes facing the opposite direction. */ -bool isect_point_planes_v3_negated(const float (*planes)[4], const int totplane, const float p[3]); +bool isect_point_planes_v3_negated(const float (*planes)[4], int totplane, const float p[3]); /** * Intersect line/plane. @@ -649,9 +643,9 @@ bool isect_plane_plane_v3(const float plane_a[4], */ bool isect_planes_v3_fn( const float planes[][4], - const int planes_len, - const float eps_coplanar, - const float eps_isect, + int planes_len, + float eps_coplanar, + float eps_isect, void (*callback_fn)(const float co[3], int i, int j, int k, void *user_data), void *user_data); @@ -678,8 +672,8 @@ bool isect_line_segment_tri_epsilon_v3(const float p1[3], const float v2[3], float *r_lambda, float r_uv[2], - const float epsilon); -bool isect_axial_line_segment_tri_v3(const int axis, + float epsilon); +bool isect_axial_line_segment_tri_v3(int axis, const float p1[3], const float p2[3], const float v0[3], @@ -705,7 +699,7 @@ bool isect_ray_tri_threshold_v3(const float ray_origin[3], const float v2[3], float *r_lambda, float r_uv[2], - const float threshold); + float threshold); bool isect_ray_tri_epsilon_v3(const float ray_origin[3], const float ray_direction[3], const float v0[3], @@ -713,7 +707,7 @@ bool isect_ray_tri_epsilon_v3(const float ray_origin[3], const float v2[3], float *r_lambda, float r_uv[2], - const float epsilon); + float epsilon); /** * Intersect two triangles. * @@ -793,12 +787,12 @@ bool isect_ray_line_v3(const float ray_origin[3], bool isect_point_poly_v2(const float pt[2], const float verts[][2], - const unsigned int nr, - const bool use_holes); + unsigned int nr, + bool use_holes); bool isect_point_poly_v2_int(const int pt[2], const int verts[][2], - const unsigned int nr, - const bool use_holes); + unsigned int nr, + bool use_holes); /** * Point in quad - only convex quads. @@ -823,8 +817,7 @@ bool isect_point_tri_v2_cw(const float pt[2], * x1,y1-- x2,y1 * \endcode */ -int isect_point_tri_v2_int( - const int x1, const int y1, const int x2, const int y2, const int a, const int b); +int isect_point_tri_v2_int(int x1, int y1, int x2, int y2, int a, int b); bool isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], @@ -890,13 +883,13 @@ bool isect_ray_aabb_v3_simple(const float orig[3], * - ISECT_AABB_PLANE_IN_FRONT_ALL (2): AABB is completely in front of all planes; */ int isect_aabb_planes_v3(const float (*planes)[4], - const int totplane, + int totplane, const float bbmin[3], const float bbmax[3]); bool isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], - const float radius, + float radius, const float v0[3], const float v1[3], const float v2[3], @@ -908,7 +901,7 @@ bool clip_segment_v3_plane( bool clip_segment_v3_plane_n(const float p1[3], const float p2[3], const float plane_array[][4], - const int plane_tot, + int plane_tot, float r_p1[3], float r_p2[3]); @@ -928,8 +921,8 @@ void interp_weights_quad_v3(float w[4], const float v3[3], const float v4[3], const float co[3]); -void interp_weights_poly_v3(float w[], float v[][3], const int n, const float co[3]); -void interp_weights_poly_v2(float w[], float v[][2], const int n, const float co[2]); +void interp_weights_poly_v3(float w[], float v[][3], int n, const float co[3]); +void interp_weights_poly_v2(float w[], float v[][2], int n, const float co[2]); /** `(x1, v1)(t1=0)------(x2, v2)(t2=1), 0<t<1 --> (x, v)(t)`. */ void interp_cubic_v3(float x[3], @@ -938,13 +931,13 @@ void interp_cubic_v3(float x[3], const float v1[3], const float x2[3], const float v2[3], - const float t); + float t); /** * Given an array with some invalid values this function interpolates valid values * replacing the invalid ones. */ -int interp_sparse_array(float *array, const int list_size, const float skipval); +int interp_sparse_array(float *array, int list_size, float skipval); /** * Given 2 triangles in 3D space, and a point in relation to the first triangle. @@ -1081,34 +1074,34 @@ void polarview_m4(float mat[4][4], float dist, float azimuth, float incidence, f * Matches `glFrustum` result. */ void perspective_m4(float mat[4][4], - const float left, - const float right, - const float bottom, - const float top, - const float nearClip, - const float farClip); + float left, + float right, + float bottom, + float top, + float nearClip, + float farClip); void perspective_m4_fov(float mat[4][4], - const float angle_left, - const float angle_right, - const float angle_up, - const float angle_down, - const float nearClip, - const float farClip); + float angle_left, + float angle_right, + float angle_up, + float angle_down, + float nearClip, + float farClip); /** * Matches `glOrtho` result. */ void orthographic_m4(float mat[4][4], - const float left, - const float right, - const float bottom, - const float top, - const float nearClip, - const float farClip); + float left, + float right, + float bottom, + float top, + float nearClip, + float farClip); /** * Translate a matrix created by orthographic_m4 or perspective_m4 in XY coords * (used to jitter the view). */ -void window_translate_m4(float winmat[4][4], float perspmat[4][4], const float x, const float y); +void window_translate_m4(float winmat[4][4], float perspmat[4][4], float x, float y); /** * Frustum planes extraction from a projection matrix @@ -1149,10 +1142,10 @@ void projmat_dimensions_db(const float winmat[4][4], */ void projmat_from_subregion(const float projmat[4][4], const int win_size[2], - const int x_min, - const int x_max, - const int y_min, - const int y_max, + int x_min, + int x_max, + int y_min, + int y_max, float r_projmat[4][4]); int box_clip_bounds_m4(float boundbox[2][3], const float bounds[4], float winmat[4][4]); @@ -1164,13 +1157,13 @@ void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], floa /** \name Mapping * \{ */ -void map_to_tube(float *r_u, float *r_v, const float x, const float y, const float z); -void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z); +void map_to_tube(float *r_u, float *r_v, float x, float y, float z); +void map_to_sphere(float *r_u, float *r_v, float x, float y, float z); void map_to_plane_v2_v3v3(float r_co[2], const float co[3], const float no[3]); void map_to_plane_axis_angle_v2_v3v3fl(float r_co[2], const float co[3], const float axis[3], - const float angle); + float angle); /** \} */ @@ -1200,11 +1193,8 @@ void accumulate_vertex_normals_v3(float n1[3], * Add weighted face normal component into normals of the face vertices. * Caller must pass pre-allocated vdiffs of nverts length. */ -void accumulate_vertex_normals_poly_v3(float **vertnos, - const float polyno[3], - const float **vertcos, - float vdiffs[][3], - const int nverts); +void accumulate_vertex_normals_poly_v3( + float **vertnos, const float polyno[3], const float **vertcos, float vdiffs[][3], int nverts); /** \} */ @@ -1246,7 +1236,7 @@ void tangent_from_uv_v3(const float uv1[2], * * pointers may be NULL if not needed */ -void vcloud_estimate_transform_v3(const int list_size, +void vcloud_estimate_transform_v3(int list_size, const float (*pos)[3], const float *weight, const float (*rpos)[3], @@ -1269,14 +1259,14 @@ void vcloud_estimate_transform_v3(const int list_size, MINLINE void zero_sh(float r[9]); MINLINE void copy_sh_sh(float r[9], const float a[9]); -MINLINE void mul_sh_fl(float r[9], const float f); +MINLINE void mul_sh_fl(float r[9], float f); MINLINE void add_sh_shsh(float r[9], const float a[9], const float b[9]); MINLINE float dot_shsh(const float a[9], const float b[9]); MINLINE float eval_shv3(float r[9], const float v[3]); MINLINE float diffuse_shv3(const float r[9], const float v[3]); -MINLINE void vec_fac_to_sh(float r[9], const float v[3], const float f); -MINLINE void madd_sh_shfl(float r[9], const float sh[9], const float f); +MINLINE void vec_fac_to_sh(float r[9], const float v[3], float f); +MINLINE void madd_sh_shfl(float r[9], const float sh[9], float f); /** \} */ @@ -1349,7 +1339,7 @@ MINLINE int min_axis_v3(const float vec[3]); * (3+ sided faces, 1-2 sided give incorrect results). * \param corner_count: The number of corners (also called loop-index). */ -MINLINE int poly_to_tri_count(const int poly_count, const int corner_count); +MINLINE int poly_to_tri_count(int poly_count, int corner_count); /** * Useful to calculate an even width shell, by taking the angle between 2 planes. @@ -1357,7 +1347,7 @@ MINLINE int poly_to_tri_count(const int poly_count, const int corner_count); * no angle between planes is 1.0, as the angle between the 2 planes approaches 180d * the distance gets very high, 180d would be inf, but this case isn't valid. */ -MINLINE float shell_angle_to_dist(const float angle); +MINLINE float shell_angle_to_dist(float angle); /** * Equivalent to `shell_angle_to_dist(angle_normalized_v3v3(a, b))`. */ @@ -1406,7 +1396,7 @@ float cubic_tangent_factor_circle_v3(const float tan_l[3], const float tan_r[3]) * From "Dart Throwing on Surfaces", EGSR 2009. Section 7, Geodesic Dart Throwing. */ float geodesic_distance_propagate_across_triangle( - const float v0[3], const float v1[3], const float v2[3], const float dist1, const float dist2); + const float v0[3], const float v1[3], const float v2[3], float dist1, float dist2); /** \} */ diff --git a/source/blender/blenlib/BLI_math_interp.h b/source/blender/blenlib/BLI_math_interp.h index 7179de12066..0af250064f6 100644 --- a/source/blender/blenlib/BLI_math_interp.h +++ b/source/blender/blenlib/BLI_math_interp.h @@ -81,10 +81,10 @@ void BLI_ewa_imp2radangle( * TODO(sergey): Consider making this function inlined, so the pixel read callback * could also be inlined in order to avoid per-pixel function calls. */ -void BLI_ewa_filter(const int width, - const int height, - const bool intpol, - const bool use_alpha, +void BLI_ewa_filter(int width, + int height, + bool intpol, + bool use_alpha, const float uv[2], const float du[2], const float dv[2], diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index 90b74e2f504..65d654bc930 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -79,8 +79,8 @@ void shuffle_m4(float R[4][4], const int index[4]); void add_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]); void add_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]); -void madd_m3_m3m3fl(float R[3][3], const float A[3][3], const float B[3][3], const float f); -void madd_m4_m4m4fl(float R[4][4], const float A[4][4], const float B[4][4], const float f); +void madd_m3_m3m3fl(float R[3][3], const float A[3][3], const float B[3][3], float f); +void madd_m4_m4m4fl(float R[4][4], const float A[4][4], const float B[4][4], float f); void sub_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]); void sub_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]); @@ -252,8 +252,8 @@ void negate_m3(float R[3][3]); void negate_mat3_m4(float R[4][4]); void negate_m4(float R[4][4]); -bool invert_m3_ex(float m[3][3], const float epsilon); -bool invert_m3_m3_ex(float m1[3][3], const float m2[3][3], const float epsilon); +bool invert_m3_ex(float m[3][3], float epsilon); +bool invert_m3_m3_ex(float m1[3][3], const float m2[3][3], float epsilon); bool invert_m3(float R[3][3]); bool invert_m3_m3(float R[3][3], const float A[3][3]); @@ -343,8 +343,8 @@ void orthogonalize_m3_stable(float R[3][3], int axis, bool normalize); */ void orthogonalize_m4_stable(float R[4][4], int axis, bool normalize); -bool orthogonalize_m3_zero_axes(float R[3][3], const float unit_length); -bool orthogonalize_m4_zero_axes(float R[4][4], const float unit_length); +bool orthogonalize_m3_zero_axes(float R[3][3], float unit_length); +bool orthogonalize_m4_zero_axes(float R[4][4], float unit_length); bool is_orthogonal_m3(const float mat[3][3]); bool is_orthogonal_m4(const float mat[4][4]); @@ -443,7 +443,7 @@ void translate_m4(float mat[4][4], float tx, float ty, float tz); * #axis_angle_to_mat4_single, #axis_angle_to_mat3_single, #angle_to_mat2 * (axis & angle args are compatible). */ -void rotate_m4(float mat[4][4], const char axis, const float angle); +void rotate_m4(float mat[4][4], char axis, float angle); /** Scale a matrix in-place. */ void rescale_m4(float mat[4][4], const float scale[3]); /** @@ -487,7 +487,7 @@ void loc_eul_size_to_mat4(float R[4][4], * Matrices are made in the order: `scale * rot * loc` */ void loc_eulO_size_to_mat4( - float R[4][4], const float loc[3], const float eul[3], const float size[3], const short order); + float R[4][4], const float loc[3], const float eul[3], const float size[3], short order); /** * Make a 4x4 matrix out of 3 transform components. * Matrices are made in the order: `scale * rot * loc` @@ -496,20 +496,11 @@ void loc_quat_size_to_mat4(float R[4][4], const float loc[3], const float quat[4], const float size[3]); -void loc_axisangle_size_to_mat4(float R[4][4], - const float loc[3], - const float axis[3], - const float angle, - const float size[3]); - -void blend_m3_m3m3(float out[3][3], - const float dst[3][3], - const float src[3][3], - const float srcweight); -void blend_m4_m4m4(float out[4][4], - const float dst[4][4], - const float src[4][4], - const float srcweight); +void loc_axisangle_size_to_mat4( + float R[4][4], const float loc[3], const float axis[3], float angle, const float size[3]); + +void blend_m3_m3m3(float out[3][3], const float dst[3][3], const float src[3][3], float srcweight); +void blend_m4_m4m4(float out[4][4], const float dst[4][4], const float src[4][4], float srcweight); /** * A polar-decomposition-based interpolation between matrix A and matrix B. @@ -527,7 +518,7 @@ void blend_m4_m4m4(float out[4][4], * \param B: Input matrix which is totally effective with `t = 1.0`. * \param t: Interpolation factor. */ -void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], const float t); +void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], float t); /** * Complete transform matrix interpolation, * based on polar-decomposition-based interpolation from #interp_m3_m3m3. @@ -537,7 +528,7 @@ void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], con * \param B: Input matrix which is totally effective with `t = 1.0`. * \param t: Interpolation factor. */ -void interp_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4], const float t); +void interp_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4], float t); bool is_negative_m3(const float mat[3][3]); bool is_negative_m4(const float mat[4][4]); diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index 8106251684d..c27cf71ce5f 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -83,12 +83,12 @@ void mul_qt_v3(const float q[4], float r[3]); /** * Simple multiply. */ -void mul_qt_fl(float q[4], const float f); +void mul_qt_fl(float q[4], float f); /** * Raise a unit quaternion to the specified power. */ -void pow_qt_fl_normalized(float q[4], const float f); +void pow_qt_fl_normalized(float q[4], float f); void sub_qt_qtqt(float q[4], const float a[4], const float b[4]); @@ -120,9 +120,9 @@ bool is_zero_qt(const float q[4]); * \param cosom: dot product from normalized vectors/quats. * \param r_w: calculated weights. */ -void interp_dot_slerp(const float t, const float cosom, float r_w[2]); -void interp_qt_qtqt(float q[4], const float a[4], const float b[4], const float t); -void add_qt_qtqt(float q[4], const float a[4], const float b[4], const float t); +void interp_dot_slerp(float t, float cosom, float r_w[2]); +void interp_qt_qtqt(float q[4], const float a[4], const float b[4], float t); +void add_qt_qtqt(float q[4], const float a[4], const float b[4], float t); /* Conversion. */ @@ -152,7 +152,7 @@ void tri_to_quat_ex(float quat[4], * \return the length of the normal, use to test for degenerate triangles. */ float tri_to_quat(float q[4], const float a[3], const float b[3], const float c[3]); -void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag); +void vec_to_quat(float q[4], const float vec[3], short axis, short upflag); /** * Calculate a rotation matrix from 2 normalized vectors. * \note `v1` and `v2` must be normalized. @@ -205,12 +205,12 @@ void print_qt(const char *str, const float q[4]); /* Conversion. */ -void axis_angle_normalized_to_quat(float r[4], const float axis[3], const float angle); -void axis_angle_to_quat(float r[4], const float axis[3], const float angle); +void axis_angle_normalized_to_quat(float r[4], const float axis[3], float angle); +void axis_angle_to_quat(float r[4], const float axis[3], float angle); /** * Axis angle to 3x3 matrix - safer version (normalization of axis performed). */ -void axis_angle_to_mat3(float R[3][3], const float axis[3], const float angle); +void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle); /** * axis angle to 3x3 matrix * @@ -222,13 +222,13 @@ void axis_angle_to_mat3(float R[3][3], const float axis[3], const float angle); */ void axis_angle_normalized_to_mat3_ex(float mat[3][3], const float axis[3], - const float angle_sin, - const float angle_cos); -void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], const float angle); + float angle_sin, + float angle_cos); +void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], float angle); /** * Axis angle to 4x4 matrix - safer version (normalization of axis performed). */ -void axis_angle_to_mat4(float R[4][4], const float axis[3], const float angle); +void axis_angle_to_mat4(float R[4][4], const float axis[3], float angle); /** * 3x3 matrix to axis angle. @@ -248,17 +248,17 @@ void mat4_to_axis_angle(float axis[3], float *angle, const float M[4][4]); */ void quat_to_axis_angle(float axis[3], float *angle, const float q[4]); -void angle_to_mat2(float R[2][2], const float angle); +void angle_to_mat2(float R[2][2], float angle); /** * Create a 3x3 rotation matrix from a single axis. */ -void axis_angle_to_mat3_single(float R[3][3], const char axis, const float angle); +void axis_angle_to_mat3_single(float R[3][3], char axis, float angle); /** * Create a 4x4 rotation matrix from a single axis. */ -void axis_angle_to_mat4_single(float R[4][4], const char axis, const float angle); +void axis_angle_to_mat4_single(float R[4][4], char axis, float angle); -void axis_angle_to_quat_single(float q[4], const char axis, const float angle); +void axis_angle_to_quat_single(float q[4], char axis, float angle); /** \} */ @@ -289,14 +289,14 @@ void quat_to_eul(float eul[3], const float quat[4]); void mat3_normalized_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]); void mat3_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]); void quat_to_compatible_eul(float eul[3], const float oldrot[3], const float quat[4]); -void rotate_eul(float eul[3], const char axis, const float angle); +void rotate_eul(float eul[3], char axis, float angle); /* Order independent. */ void compatible_eul(float eul[3], const float old[3]); -void add_eul_euleul(float r_eul[3], float a[3], float b[3], const short order); -void sub_eul_euleul(float r_eul[3], float a[3], float b[3], const short order); +void add_eul_euleul(float r_eul[3], float a[3], float b[3], short order); +void sub_eul_euleul(float r_eul[3], float a[3], float b[3], short order); /** \} */ @@ -321,67 +321,58 @@ typedef enum eEulerRotationOrders { /** * Construct quaternion from Euler angles (in radians). */ -void eulO_to_quat(float quat[4], const float eul[3], const short order); +void eulO_to_quat(float quat[4], const float eul[3], short order); /** * Construct 3x3 matrix from Euler angles (in radians). */ -void eulO_to_mat3(float mat[3][3], const float eul[3], const short order); +void eulO_to_mat3(float mat[3][3], const float eul[3], short order); /** * Construct 4x4 matrix from Euler angles (in radians). */ -void eulO_to_mat4(float mat[4][4], const float eul[3], const short order); +void eulO_to_mat4(float mat[4][4], const float eul[3], short order); /** * Euler Rotation to Axis Angle. */ -void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], const short order); +void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], short order); /** * The matrix is written to as 3 axis vectors. */ -void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order); +void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], short order); /** * Convert 3x3 matrix to Euler angles (in radians). */ -void mat3_normalized_to_eulO(float eul[3], const short order, const float mat[3][3]); +void mat3_normalized_to_eulO(float eul[3], short order, const float mat[3][3]); /** * Convert 4x4 matrix to Euler angles (in radians). */ -void mat4_normalized_to_eulO(float eul[3], const short order, const float mat[4][4]); -void mat3_to_eulO(float eul[3], const short order, const float mat[3][3]); -void mat4_to_eulO(float eul[3], const short order, const float mat[4][4]); +void mat4_normalized_to_eulO(float eul[3], short order, const float mat[4][4]); +void mat3_to_eulO(float eul[3], short order, const float mat[3][3]); +void mat4_to_eulO(float eul[3], short order, const float mat[4][4]); /** * Convert quaternion to Euler angles (in radians). */ -void quat_to_eulO(float eul[3], const short order, const float quat[4]); +void quat_to_eulO(float eul[3], short order, const float quat[4]); /** * Axis Angle to Euler Rotation. */ -void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle); +void axis_angle_to_eulO(float eul[3], short order, const float axis[3], float angle); /* Uses 2 methods to retrieve eulers, and picks the closest. */ void mat3_normalized_to_compatible_eulO(float eul[3], const float old[3], - const short order, + short order, const float mat[3][3]); void mat4_normalized_to_compatible_eulO(float eul[3], const float old[3], - const short order, + short order, const float mat[4][4]); -void mat3_to_compatible_eulO(float eul[3], - const float old[3], - const short order, - const float mat[3][3]); -void mat4_to_compatible_eulO(float eul[3], - const float old[3], - const short order, - const float mat[4][4]); -void quat_to_compatible_eulO(float eul[3], - const float old[3], - const short order, - const float quat[4]); - -void rotate_eulO(float eul[3], const short order, char axis, float angle); +void mat3_to_compatible_eulO(float eul[3], const float old[3], short order, const float mat[3][3]); +void mat4_to_compatible_eulO(float eul[3], const float old[3], short order, const float mat[4][4]); +void quat_to_compatible_eulO(float eul[3], const float old[3], short order, const float quat[4]); + +void rotate_eulO(float eul[3], short order, char axis, float angle); /** \} */ diff --git a/source/blender/blenlib/BLI_math_solvers.h b/source/blender/blenlib/BLI_math_solvers.h index 32d4577899c..ca413d2b49c 100644 --- a/source/blender/blenlib/BLI_math_solvers.h +++ b/source/blender/blenlib/BLI_math_solvers.h @@ -77,7 +77,7 @@ void BLI_svd_m3(const float m3[3][3], float r_U[3][3], float r_S[3], float r_V[3 * \return true if success */ bool BLI_tridiagonal_solve( - const float *a, const float *b, const float *c, const float *d, float *r_x, const int count); + const float *a, const float *b, const float *c, const float *d, float *r_x, int count); /** * \brief Solve a possibly cyclic tridiagonal system using the Sherman-Morrison formula. * @@ -85,7 +85,7 @@ bool BLI_tridiagonal_solve( * \return true if success */ bool BLI_tridiagonal_solve_cyclic( - const float *a, const float *b, const float *c, const float *d, float *r_x, const int count); + const float *a, const float *b, const float *c, const float *d, float *r_x, int count); /** * Generic 3 variable Newton's method solver. diff --git a/source/blender/blenlib/BLI_math_statistics.h b/source/blender/blenlib/BLI_math_statistics.h index e4524b49f3f..586c82a8844 100644 --- a/source/blender/blenlib/BLI_math_statistics.h +++ b/source/blender/blenlib/BLI_math_statistics.h @@ -51,11 +51,11 @@ extern "C" { * (i.e. get 'sample variance' instead of 'population variance'). * \return r_covmat the computed covariance matrix. */ -void BLI_covariance_m_vn_ex(const int n, +void BLI_covariance_m_vn_ex(int n, const float *cos_vn, - const int nbr_cos_vn, + int nbr_cos_vn, const float *center, - const bool use_sample_correction, + bool use_sample_correction, float *r_covmat); /** * \brief Compute the covariance matrix of given set of 3D coordinates. @@ -66,8 +66,8 @@ void BLI_covariance_m_vn_ex(const int n, * \return r_center the computed center (mean) of 3D points (may be NULL). */ void BLI_covariance_m3_v3n(const float (*cos_v3)[3], - const int nbr_cos_v3, - const bool use_sample_correction, + int nbr_cos_v3, + bool use_sample_correction, float r_covmat[3][3], float r_center[3]); diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 61090e30f7b..5e997d94acf 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -64,9 +64,9 @@ MINLINE void copy_v2_v2_uchar(unsigned char r[2], const unsigned char a[2]); MINLINE void copy_v3_v3_uchar(unsigned char r[3], const unsigned char a[3]); MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4]); -MINLINE void copy_v2_uchar(unsigned char r[2], const unsigned char a); -MINLINE void copy_v3_uchar(unsigned char r[3], const unsigned char a); -MINLINE void copy_v4_uchar(unsigned char r[4], const unsigned char a); +MINLINE void copy_v2_uchar(unsigned char r[2], unsigned char a); +MINLINE void copy_v3_uchar(unsigned char r[3], unsigned char a); +MINLINE void copy_v4_uchar(unsigned char r[4], unsigned char a); /* char */ @@ -303,18 +303,18 @@ MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESU MINLINE double len_v3_db(const double a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE double len_squared_v3_db(const double v[3]) ATTR_WARN_UNUSED_RESULT; -MINLINE float normalize_v2_length(float r[2], const float unit_scale); +MINLINE float normalize_v2_length(float r[2], float unit_scale); /** * \note any vectors containing `nan` will be zeroed out. */ -MINLINE float normalize_v2_v2_length(float r[2], const float a[2], const float unit_scale); -MINLINE float normalize_v3_length(float r[3], const float unit_scale); +MINLINE float normalize_v2_v2_length(float r[2], const float a[2], float unit_scale); +MINLINE float normalize_v3_length(float r[3], float unit_scale); /** * \note any vectors containing `nan` will be zeroed out. */ -MINLINE float normalize_v3_v3_length(float r[3], const float a[3], const float unit_scale); -MINLINE double normalize_v3_length_db(double n[3], const double unit_scale); -MINLINE double normalize_v3_v3_length_db(double r[3], const double a[3], const double unit_scale); +MINLINE float normalize_v3_v3_length(float r[3], const float a[3], float unit_scale); +MINLINE double normalize_v3_length_db(double n[3], double unit_scale); +MINLINE double normalize_v3_v3_length_db(double r[3], const double a[3], double unit_scale); MINLINE float normalize_v2(float r[2]); MINLINE float normalize_v2_v2(float r[2], const float a[2]); @@ -329,16 +329,16 @@ MINLINE double normalize_v3_db(double n[3]); /** \name Interpolation * \{ */ -void interp_v2_v2v2(float r[2], const float a[2], const float b[2], const float t); -void interp_v2_v2v2_db(double target[2], const double a[2], const double b[2], const double t); +void interp_v2_v2v2(float r[2], const float a[2], const float b[2], float t); +void interp_v2_v2v2_db(double target[2], const double a[2], const double b[2], double t); /** * Weight 3 2D vectors, * 'w' must be unit length but is not a vector, just 3 weights. */ void interp_v2_v2v2v2( float r[2], const float a[2], const float b[2], const float c[2], const float t[3]); -void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t); -void interp_v3_v3v3_db(double target[3], const double a[3], const double b[3], const double t); +void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t); +void interp_v3_v3v3_db(double target[3], const double a[3], const double b[3], double t); /** * Weight 3 vectors, * 'w' must be unit length but is not a vector, just 3 weights. @@ -355,7 +355,7 @@ void interp_v3_v3v3v3v3(float p[3], const float v3[3], const float v4[3], const float w[4]); -void interp_v4_v4v4(float r[4], const float a[4], const float b[4], const float t); +void interp_v4_v4v4(float r[4], const float a[4], const float b[4], float t); void interp_v4_v4v4v4( float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3]); void interp_v4_v4v4v4v4(float p[4], @@ -373,34 +373,34 @@ void interp_v3_v3v3v3_uv( * * \return success */ -bool interp_v3_v3v3_slerp(float target[3], const float a[3], const float b[3], const float t) +bool interp_v3_v3v3_slerp(float target[3], const float a[3], const float b[3], float t) ATTR_WARN_UNUSED_RESULT; -bool interp_v2_v2v2_slerp(float target[2], const float a[2], const float b[2], const float t) +bool interp_v2_v2v2_slerp(float target[2], const float a[2], const float b[2], float t) ATTR_WARN_UNUSED_RESULT; /** * Same as #interp_v3_v3v3_slerp but uses fallback values for opposite vectors. */ -void interp_v3_v3v3_slerp_safe(float target[3], const float a[3], const float b[3], const float t); -void interp_v2_v2v2_slerp_safe(float target[2], const float a[2], const float b[2], const float t); +void interp_v3_v3v3_slerp_safe(float target[3], const float a[3], const float b[3], float t); +void interp_v2_v2v2_slerp_safe(float target[2], const float a[2], const float b[2], float t); void interp_v2_v2v2v2v2_cubic(float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2], - const float u); + float u); -void interp_v3_v3v3_char(char target[3], const char a[3], const char b[3], const float t); +void interp_v3_v3v3_char(char target[3], const char a[3], const char b[3], float t); void interp_v3_v3v3_uchar(unsigned char target[3], const unsigned char a[3], const unsigned char b[3], - const float t); -void interp_v4_v4v4_char(char target[4], const char a[4], const char b[4], const float t); + float t); +void interp_v4_v4v4_char(char target[4], const char a[4], const char b[4], float t); void interp_v4_v4v4_uchar(unsigned char target[4], const unsigned char a[4], const unsigned char b[4], - const float t); + float t); void mid_v3_v3v3(float r[3], const float a[3], const float b[3]); void mid_v2_v2v2(float r[2], const float a[2], const float b[2]); @@ -408,7 +408,7 @@ void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float void mid_v2_v2v2v2(float v[2], const float v1[2], const float v2[2], const float v3[2]); void mid_v3_v3v3v3v3( float v[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3]); -void mid_v3_v3_array(float r[3], const float (*vec_arr)[3], const unsigned int nbr); +void mid_v3_v3_array(float r[3], const float (*vec_arr)[3], unsigned int nbr); /** * Specialized function for calculating normals. @@ -461,36 +461,24 @@ MINLINE bool equals_v2v2_int(const int v1[2], const int v2[2]) ATTR_WARN_UNUSED_ MINLINE bool equals_v3v3_int(const int v1[3], const int v2[3]) ATTR_WARN_UNUSED_RESULT; MINLINE bool equals_v4v4_int(const int v1[4], const int v2[4]) ATTR_WARN_UNUSED_RESULT; -MINLINE bool compare_v2v2(const float a[2], - const float b[2], - const float limit) ATTR_WARN_UNUSED_RESULT; -MINLINE bool compare_v3v3(const float a[3], - const float b[3], - const float limit) ATTR_WARN_UNUSED_RESULT; -MINLINE bool compare_v4v4(const float a[4], - const float b[4], - const float limit) ATTR_WARN_UNUSED_RESULT; - -MINLINE bool compare_v2v2_relative(const float a[2], - const float b[2], - const float limit, - const int max_ulps) ATTR_WARN_UNUSED_RESULT; -MINLINE bool compare_v3v3_relative(const float a[3], - const float b[3], - const float limit, - const int max_ulps) ATTR_WARN_UNUSED_RESULT; -MINLINE bool compare_v4v4_relative(const float a[4], - const float b[4], - const float limit, - const int max_ulps) ATTR_WARN_UNUSED_RESULT; +MINLINE bool compare_v2v2(const float a[2], const float b[2], float limit) ATTR_WARN_UNUSED_RESULT; +MINLINE bool compare_v3v3(const float a[3], const float b[3], float limit) ATTR_WARN_UNUSED_RESULT; +MINLINE bool compare_v4v4(const float a[4], const float b[4], float limit) ATTR_WARN_UNUSED_RESULT; + +MINLINE bool compare_v2v2_relative(const float a[2], const float b[2], float limit, int max_ulps) + ATTR_WARN_UNUSED_RESULT; +MINLINE bool compare_v3v3_relative(const float a[3], const float b[3], float limit, int max_ulps) + ATTR_WARN_UNUSED_RESULT; +MINLINE bool compare_v4v4_relative(const float a[4], const float b[4], float limit, int max_ulps) + ATTR_WARN_UNUSED_RESULT; MINLINE bool compare_len_v3v3(const float a[3], const float b[3], - const float limit) ATTR_WARN_UNUSED_RESULT; + float limit) ATTR_WARN_UNUSED_RESULT; MINLINE bool compare_size_v3v3(const float a[3], const float b[3], - const float limit) ATTR_WARN_UNUSED_RESULT; + float limit) ATTR_WARN_UNUSED_RESULT; /** * <pre> @@ -658,16 +646,13 @@ void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const floa /** * Rotate a point \a p by \a angle around origin (0, 0) */ -void rotate_v2_v2fl(float r[2], const float p[2], const float angle); -void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], const float angle); +void rotate_v2_v2fl(float r[2], const float p[2], float angle); +void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], float angle); /** * Rotate a point \a p by \a angle around an arbitrary unit length \a axis. * http://local.wasp.uwa.edu.au/~pbourke/geometry/ */ -void rotate_normalized_v3_v3v3fl(float out[3], - const float p[3], - const float axis[3], - const float angle); +void rotate_normalized_v3_v3v3fl(float out[3], const float p[3], const float axis[3], float angle); /** \} */ @@ -678,7 +663,7 @@ void rotate_normalized_v3_v3v3fl(float out[3], void print_v2(const char *str, const float v[2]); void print_v3(const char *str, const float v[3]); void print_v4(const char *str, const float v[4]); -void print_vn(const char *str, const float v[], const int n); +void print_vn(const char *str, const float v[], int n); #define print_v2_id(v) print_v2(STRINGIFY(v), v) #define print_v3_id(v) print_v3(STRINGIFY(v), v) @@ -697,14 +682,14 @@ void minmax_v2v2_v2(float min[2], float max[2], const float vec[2]); void minmax_v3v3_v3_array(float r_min[3], float r_max[3], const float (*vec_arr)[3], int nbr); /** ensure \a v1 is \a dist from \a v2 */ -void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist); -void dist_ensure_v2_v2fl(float v1[2], const float v2[2], const float dist); +void dist_ensure_v3_v3fl(float v1[3], const float v2[3], float dist); +void dist_ensure_v2_v2fl(float v1[2], const float v2[2], float dist); void axis_sort_v3(const float axis_values[3], int r_axis_order[3]); -MINLINE void clamp_v2(float vec[2], const float min, const float max); -MINLINE void clamp_v3(float vec[3], const float min, const float max); -MINLINE void clamp_v4(float vec[4], const float min, const float max); +MINLINE void clamp_v2(float vec[2], float min, float max); +MINLINE void clamp_v3(float vec[3], float min, float max); +MINLINE void clamp_v4(float vec[4], float min, float max); MINLINE void clamp_v2_v2v2(float vec[2], const float min[2], const float max[2]); MINLINE void clamp_v3_v3v3(float vec[3], const float min[3], const float max[3]); MINLINE void clamp_v4_v4v4(float vec[4], const float min[4], const float max[4]); @@ -721,57 +706,42 @@ MINLINE void clamp_v4_v4v4(float vec[4], const float min[4], const float max[4]) double dot_vn_vn(const float *array_src_a, const float *array_src_b, - const int size) ATTR_WARN_UNUSED_RESULT; -double len_squared_vn(const float *array, const int size) ATTR_WARN_UNUSED_RESULT; -float normalize_vn_vn(float *array_tar, const float *array_src, const int size); -float normalize_vn(float *array_tar, const int size); -void range_vn_i(int *array_tar, const int size, const int start); -void range_vn_u(unsigned int *array_tar, const int size, const unsigned int start); -void range_vn_fl(float *array_tar, const int size, const float start, const float step); -void negate_vn(float *array_tar, const int size); -void negate_vn_vn(float *array_tar, const float *array_src, const int size); -void mul_vn_vn(float *array_tar, const float *array_src, const int size); -void mul_vn_vnvn(float *array_tar, - const float *array_src_a, - const float *array_src_b, - const int size); -void mul_vn_fl(float *array_tar, const int size, const float f); -void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f); -void add_vn_vn(float *array_tar, const float *array_src, const int size); -void add_vn_vnvn(float *array_tar, - const float *array_src_a, - const float *array_src_b, - const int size); -void madd_vn_vn(float *array_tar, const float *array_src, const float f, const int size); -void madd_vn_vnvn(float *array_tar, - const float *array_src_a, - const float *array_src_b, - const float f, - const int size); -void sub_vn_vn(float *array_tar, const float *array_src, const int size); -void sub_vn_vnvn(float *array_tar, - const float *array_src_a, - const float *array_src_b, - const int size); -void msub_vn_vn(float *array_tar, const float *array_src, const float f, const int size); -void msub_vn_vnvn(float *array_tar, - const float *array_src_a, - const float *array_src_b, - const float f, - const int size); -void interp_vn_vn(float *array_tar, const float *array_src, const float t, const int size); -void copy_vn_i(int *array_tar, const int size, const int val); -void copy_vn_short(short *array_tar, const int size, const short val); -void copy_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val); -void copy_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val); -void copy_vn_fl(float *array_tar, const int size, const float val); - -void add_vn_vn_d(double *array_tar, const double *array_src, const int size); + int size) ATTR_WARN_UNUSED_RESULT; +double len_squared_vn(const float *array, int size) ATTR_WARN_UNUSED_RESULT; +float normalize_vn_vn(float *array_tar, const float *array_src, int size); +float normalize_vn(float *array_tar, int size); +void range_vn_i(int *array_tar, int size, int start); +void range_vn_u(unsigned int *array_tar, int size, unsigned int start); +void range_vn_fl(float *array_tar, int size, float start, float step); +void negate_vn(float *array_tar, int size); +void negate_vn_vn(float *array_tar, const float *array_src, int size); +void mul_vn_vn(float *array_tar, const float *array_src, int size); +void mul_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, int size); +void mul_vn_fl(float *array_tar, int size, float f); +void mul_vn_vn_fl(float *array_tar, const float *array_src, int size, float f); +void add_vn_vn(float *array_tar, const float *array_src, int size); +void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, int size); +void madd_vn_vn(float *array_tar, const float *array_src, float f, int size); +void madd_vn_vnvn( + float *array_tar, const float *array_src_a, const float *array_src_b, float f, int size); +void sub_vn_vn(float *array_tar, const float *array_src, int size); +void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, int size); +void msub_vn_vn(float *array_tar, const float *array_src, float f, int size); +void msub_vn_vnvn( + float *array_tar, const float *array_src_a, const float *array_src_b, float f, int size); +void interp_vn_vn(float *array_tar, const float *array_src, float t, int size); +void copy_vn_i(int *array_tar, int size, int val); +void copy_vn_short(short *array_tar, int size, short val); +void copy_vn_ushort(unsigned short *array_tar, int size, unsigned short val); +void copy_vn_uchar(unsigned char *array_tar, int size, unsigned char val); +void copy_vn_fl(float *array_tar, int size, float val); + +void add_vn_vn_d(double *array_tar, const double *array_src, int size); void add_vn_vnvn_d(double *array_tar, const double *array_src_a, const double *array_src_b, - const int size); -void mul_vn_db(double *array_tar, const int size, const double f); + int size); +void mul_vn_db(double *array_tar, int size, double f); /** \} */ diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index a3cf2a77646..d1999a468b8 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -56,7 +56,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1, 2); * \param pool: The pool to clear. * \param totelem_reserve: Optionally reserve how many items should be kept from clearing. */ -void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve) ATTR_NONNULL(1); +void BLI_mempool_clear_ex(BLI_mempool *pool, int totelem_reserve) ATTR_NONNULL(1); /** * Wrap #BLI_mempool_clear_ex with no reserve set. */ diff --git a/source/blender/blenlib/BLI_mesh_intersect.hh b/source/blender/blenlib/BLI_mesh_intersect.hh index 4aaed814bba..71a8abb822f 100644 --- a/source/blender/blenlib/BLI_mesh_intersect.hh +++ b/source/blender/blenlib/BLI_mesh_intersect.hh @@ -91,7 +91,7 @@ struct Plane { Plane() = default; Plane(const mpq3 &norm_exact, const mpq_class &d_exact); - Plane(const double3 &norm, const double d); + Plane(const double3 &norm, double d); /** Test equality on the exact fields. */ bool operator==(const Plane &other) const; diff --git a/source/blender/blenlib/BLI_noise.hh b/source/blender/blenlib/BLI_noise.hh index 44af2c44f00..4f68ef17ca2 100644 --- a/source/blender/blenlib/BLI_noise.hh +++ b/source/blender/blenlib/BLI_noise.hh @@ -133,12 +133,8 @@ float3 perlin_float3_fractal_distorted(float4 position, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_ridged_multi_fractal(const float co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_ridged_multi_fractal( + float co, float H, float lacunarity, float octaves, float offset, float gain); /** * 2D Ridged Multi-fractal Terrain * @@ -147,12 +143,8 @@ float musgrave_ridged_multi_fractal(const float co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_ridged_multi_fractal(const float2 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_ridged_multi_fractal( + const float2 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 3D Ridged Multi-fractal Terrain * @@ -161,12 +153,8 @@ float musgrave_ridged_multi_fractal(const float2 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_ridged_multi_fractal(const float3 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_ridged_multi_fractal( + const float3 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 4D Ridged Multi-fractal Terrain * @@ -175,12 +163,8 @@ float musgrave_ridged_multi_fractal(const float3 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_ridged_multi_fractal(const float4 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_ridged_multi_fractal( + const float4 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 1D Hybrid Additive/Multiplicative Multi-fractal Terrain @@ -190,12 +174,8 @@ float musgrave_ridged_multi_fractal(const float4 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hybrid_multi_fractal(const float co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_hybrid_multi_fractal( + float co, float H, float lacunarity, float octaves, float offset, float gain); /** * 2D Hybrid Additive/Multiplicative Multi-fractal Terrain * @@ -204,12 +184,8 @@ float musgrave_hybrid_multi_fractal(const float co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hybrid_multi_fractal(const float2 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_hybrid_multi_fractal( + const float2 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 3D Hybrid Additive/Multiplicative Multi-fractal Terrain * @@ -218,12 +194,8 @@ float musgrave_hybrid_multi_fractal(const float2 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hybrid_multi_fractal(const float3 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_hybrid_multi_fractal( + const float3 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 4D Hybrid Additive/Multiplicative Multi-fractal Terrain * @@ -232,12 +204,8 @@ float musgrave_hybrid_multi_fractal(const float3 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hybrid_multi_fractal(const float4 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_hybrid_multi_fractal( + const float4 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 1D Musgrave fBm @@ -246,7 +214,7 @@ float musgrave_hybrid_multi_fractal(const float4 co, * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_fBm(const float co, const float H, const float lacunarity, const float octaves); +float musgrave_fBm(float co, float H, float lacunarity, float octaves); /** * 2D Musgrave fBm @@ -255,7 +223,7 @@ float musgrave_fBm(const float co, const float H, const float lacunarity, const * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_fBm(const float2 co, const float H, const float lacunarity, const float octaves); +float musgrave_fBm(const float2 co, float H, float lacunarity, float octaves); /** * 3D Musgrave fBm * @@ -263,7 +231,7 @@ float musgrave_fBm(const float2 co, const float H, const float lacunarity, const * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_fBm(const float3 co, const float H, const float lacunarity, const float octaves); +float musgrave_fBm(const float3 co, float H, float lacunarity, float octaves); /** * 4D Musgrave fBm * @@ -271,7 +239,7 @@ float musgrave_fBm(const float3 co, const float H, const float lacunarity, const * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_fBm(const float4 co, const float H, const float lacunarity, const float octaves); +float musgrave_fBm(const float4 co, float H, float lacunarity, float octaves); /** * 1D Musgrave Multi-fractal @@ -280,10 +248,7 @@ float musgrave_fBm(const float4 co, const float H, const float lacunarity, const * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_multi_fractal(const float co, - const float H, - const float lacunarity, - const float octaves); +float musgrave_multi_fractal(float co, float H, float lacunarity, float octaves); /** * 2D Musgrave Multi-fractal * @@ -291,10 +256,7 @@ float musgrave_multi_fractal(const float co, * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_multi_fractal(const float2 co, - const float H, - const float lacunarity, - const float octaves); +float musgrave_multi_fractal(const float2 co, float H, float lacunarity, float octaves); /** * 3D Musgrave Multi-fractal * @@ -302,10 +264,7 @@ float musgrave_multi_fractal(const float2 co, * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_multi_fractal(const float3 co, - const float H, - const float lacunarity, - const float octaves); +float musgrave_multi_fractal(const float3 co, float H, float lacunarity, float octaves); /** * 4D Musgrave Multi-fractal * @@ -313,10 +272,7 @@ float musgrave_multi_fractal(const float3 co, * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_multi_fractal(const float4 co, - const float H, - const float lacunarity, - const float octaves); +float musgrave_multi_fractal(const float4 co, float H, float lacunarity, float octaves); /** * 1D Musgrave Heterogeneous Terrain @@ -326,11 +282,7 @@ float musgrave_multi_fractal(const float4 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hetero_terrain(const float co, - const float H, - const float lacunarity, - const float octaves, - const float offset); +float musgrave_hetero_terrain(float co, float H, float lacunarity, float octaves, float offset); /** * 2D Musgrave Heterogeneous Terrain * @@ -339,11 +291,8 @@ float musgrave_hetero_terrain(const float co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hetero_terrain(const float2 co, - const float H, - const float lacunarity, - const float octaves, - const float offset); +float musgrave_hetero_terrain( + const float2 co, float H, float lacunarity, float octaves, float offset); /** * 3D Musgrave Heterogeneous Terrain * @@ -352,11 +301,8 @@ float musgrave_hetero_terrain(const float2 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hetero_terrain(const float3 co, - const float H, - const float lacunarity, - const float octaves, - const float offset); +float musgrave_hetero_terrain( + const float3 co, float H, float lacunarity, float octaves, float offset); /** * 4D Musgrave Heterogeneous Terrain * @@ -365,11 +311,8 @@ float musgrave_hetero_terrain(const float3 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hetero_terrain(const float4 co, - const float H, - const float lacunarity, - const float octaves, - const float offset); +float musgrave_hetero_terrain( + const float4 co, float H, float lacunarity, float octaves, float offset); /** \} */ @@ -377,93 +320,87 @@ float musgrave_hetero_terrain(const float4 co, /** \name Voronoi Noise * \{ */ -void voronoi_f1( - const float w, const float randomness, float *r_distance, float3 *r_color, float *r_w); -void voronoi_smooth_f1(const float w, - const float smoothness, - const float randomness, - float *r_distance, - float3 *r_color, - float *r_w); -void voronoi_f2( - const float w, const float randomness, float *r_distance, float3 *r_color, float *r_w); -void voronoi_distance_to_edge(const float w, const float randomness, float *r_distance); -void voronoi_n_sphere_radius(const float w, const float randomness, float *r_radius); +void voronoi_f1(float w, float randomness, float *r_distance, float3 *r_color, float *r_w); +void voronoi_smooth_f1( + float w, float smoothness, float randomness, float *r_distance, float3 *r_color, float *r_w); +void voronoi_f2(float w, float randomness, float *r_distance, float3 *r_color, float *r_w); +void voronoi_distance_to_edge(float w, float randomness, float *r_distance); +void voronoi_n_sphere_radius(float w, float randomness, float *r_radius); void voronoi_f1(const float2 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float2 *r_position); void voronoi_smooth_f1(const float2 coord, - const float smoothness, - const float exponent, - const float randomness, - const int metric, + float smoothness, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float2 *r_position); void voronoi_f2(const float2 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float2 *r_position); -void voronoi_distance_to_edge(const float2 coord, const float randomness, float *r_distance); -void voronoi_n_sphere_radius(const float2 coord, const float randomness, float *r_radius); +void voronoi_distance_to_edge(const float2 coord, float randomness, float *r_distance); +void voronoi_n_sphere_radius(const float2 coord, float randomness, float *r_radius); void voronoi_f1(const float3 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float3 *r_position); void voronoi_smooth_f1(const float3 coord, - const float smoothness, - const float exponent, - const float randomness, - const int metric, + float smoothness, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float3 *r_position); void voronoi_f2(const float3 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float3 *r_position); -void voronoi_distance_to_edge(const float3 coord, const float randomness, float *r_distance); -void voronoi_n_sphere_radius(const float3 coord, const float randomness, float *r_radius); +void voronoi_distance_to_edge(const float3 coord, float randomness, float *r_distance); +void voronoi_n_sphere_radius(const float3 coord, float randomness, float *r_radius); void voronoi_f1(const float4 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float4 *r_position); void voronoi_smooth_f1(const float4 coord, - const float smoothness, - const float exponent, - const float randomness, - const int metric, + float smoothness, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float4 *r_position); void voronoi_f2(const float4 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float4 *r_position); -void voronoi_distance_to_edge(const float4 coord, const float randomness, float *r_distance); -void voronoi_n_sphere_radius(const float4 coord, const float randomness, float *r_radius); +void voronoi_distance_to_edge(const float4 coord, float randomness, float *r_distance); +void voronoi_n_sphere_radius(const float4 coord, float randomness, float *r_radius); /** \} */ diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 70eb80e7763..85d4ed4a307 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -133,7 +133,7 @@ const char *BLI_path_basename(const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_ * Ignores multiple slashes at any point in the path (including start/end). */ bool BLI_path_name_at_index(const char *__restrict path, - const int index, + int index, int *__restrict r_offset, int *__restrict r_len) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; diff --git a/source/blender/blenlib/BLI_polyfill_2d.h b/source/blender/blenlib/BLI_polyfill_2d.h index d16c102ec86..25a624ba005 100644 --- a/source/blender/blenlib/BLI_polyfill_2d.h +++ b/source/blender/blenlib/BLI_polyfill_2d.h @@ -30,8 +30,8 @@ struct MemArena; * A version of #BLI_polyfill_calc that uses a memory arena to avoid re-allocations. */ void BLI_polyfill_calc_arena(const float (*coords)[2], - const unsigned int coords_tot, - const int coords_sign, + unsigned int coords_tot, + int coords_sign, unsigned int (*r_tris)[3], struct MemArena *arena); @@ -50,8 +50,8 @@ void BLI_polyfill_calc_arena(const float (*coords)[2], * even in the case of degenerate input (self intersecting polygons, zero area ears... etc). */ void BLI_polyfill_calc(const float (*coords)[2], - const unsigned int coords_tot, - const int coords_sign, + unsigned int coords_tot, + int coords_sign, unsigned int (*r_tris)[3]); /* default size of polyfill arena */ diff --git a/source/blender/blenlib/BLI_polyfill_2d_beautify.h b/source/blender/blenlib/BLI_polyfill_2d_beautify.h index b0b97336a3b..3a94ef46aca 100644 --- a/source/blender/blenlib/BLI_polyfill_2d_beautify.h +++ b/source/blender/blenlib/BLI_polyfill_2d_beautify.h @@ -34,7 +34,7 @@ struct MemArena; * are ignored since the edges won't share 2 faces. */ void BLI_polyfill_beautify(const float (*coords)[2], - const unsigned int coords_tot, + unsigned int coords_tot, unsigned int (*tris)[3], /* structs for reuse */ @@ -60,7 +60,7 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(const float v1[2], const float v2[2], const float v3[2], const float v4[2], - const bool lock_degenerate, + bool lock_degenerate, float *r_area); #define BLI_polyfill_beautify_quad_rotate_calc(v1, v2, v3, v4) \ BLI_polyfill_beautify_quad_rotate_calc_ex(v1, v2, v3, v4, false, NULL) diff --git a/source/blender/blenlib/BLI_quadric.h b/source/blender/blenlib/BLI_quadric.h index 450653a20ea..03642023986 100644 --- a/source/blender/blenlib/BLI_quadric.h +++ b/source/blender/blenlib/BLI_quadric.h @@ -42,12 +42,12 @@ void BLI_quadric_clear(Quadric *q); void BLI_quadric_add_qu_qu(Quadric *a, const Quadric *b); void BLI_quadric_add_qu_ququ(Quadric *r, const Quadric *a, const Quadric *b); -void BLI_quadric_mul(Quadric *a, const double scalar); +void BLI_quadric_mul(Quadric *a, double scalar); /* Solve. */ double BLI_quadric_evaluate(const Quadric *q, const double v[3]); -bool BLI_quadric_optimize(const Quadric *q, double v[3], const double epsilon); +bool BLI_quadric_optimize(const Quadric *q, double v[3], double epsilon); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index f4b1d051d16..b8906a97977 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -101,16 +101,13 @@ void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y); void BLI_rctf_resize(struct rctf *rect, float x, float y); void BLI_rctf_resize_x(struct rctf *rect, float x); void BLI_rctf_resize_y(struct rctf *rect, float y); -void BLI_rcti_scale(rcti *rect, const float scale); -void BLI_rctf_scale(rctf *rect, const float scale); -void BLI_rctf_pad_y(struct rctf *rect, - const float boundary_size, - const float pad_min, - const float pad_max); +void BLI_rcti_scale(rcti *rect, float scale); +void BLI_rctf_scale(rctf *rect, float scale); +void BLI_rctf_pad_y(struct rctf *rect, float boundary_size, float pad_min, float pad_max); void BLI_rctf_interp(struct rctf *rect, const struct rctf *rect_a, const struct rctf *rect_b, - const float fac); + float fac); // void BLI_rcti_interp(struct rctf *rect, struct rctf *rect_a, struct rctf *rect_b, float fac); bool BLI_rctf_clamp_pt_v(const struct rctf *rect, float xy[2]); bool BLI_rcti_clamp_pt_v(const struct rcti *rect, int xy[2]); @@ -124,7 +121,7 @@ bool BLI_rcti_clamp_pt_v(const struct rcti *rect, int xy[2]); */ bool BLI_rctf_clamp(struct rctf *rect, const struct rctf *rect_bounds, float r_xy[2]); bool BLI_rcti_clamp(struct rcti *rect, const struct rcti *rect_bounds, int r_xy[2]); -bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit); +bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, float limit); bool BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b); bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest); bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest); @@ -132,28 +129,28 @@ bool BLI_rctf_isect_rect_x(const struct rctf *src1, const struct rctf *src2, flo bool BLI_rctf_isect_rect_y(const struct rctf *src1, const struct rctf *src2, float range_y[2]); bool BLI_rcti_isect_rect_x(const struct rcti *src1, const struct rcti *src2, int range_x[2]); bool BLI_rcti_isect_rect_y(const struct rcti *src1, const struct rcti *src2, int range_y[2]); -bool BLI_rcti_isect_x(const rcti *rect, const int x); -bool BLI_rcti_isect_y(const rcti *rect, const int y); -bool BLI_rcti_isect_pt(const struct rcti *rect, const int x, const int y); +bool BLI_rcti_isect_x(const rcti *rect, int x); +bool BLI_rcti_isect_y(const rcti *rect, int y); +bool BLI_rcti_isect_pt(const struct rcti *rect, int x, int y); bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2]); -bool BLI_rctf_isect_x(const rctf *rect, const float x); -bool BLI_rctf_isect_y(const rctf *rect, const float y); -bool BLI_rctf_isect_pt(const struct rctf *rect, const float x, const float y); +bool BLI_rctf_isect_x(const rctf *rect, float x); +bool BLI_rctf_isect_y(const rctf *rect, float y); +bool BLI_rctf_isect_pt(const struct rctf *rect, float x, float y); bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2]); /** * \returns shortest distance from \a rect to x (0 if inside) */ -int BLI_rcti_length_x(const rcti *rect, const int x); +int BLI_rcti_length_x(const rcti *rect, int x); /** * \returns shortest distance from \a rect to y (0 if inside) */ -int BLI_rcti_length_y(const rcti *rect, const int y); -float BLI_rctf_length_x(const rctf *rect, const float x); -float BLI_rctf_length_y(const rctf *rect, const float y); +int BLI_rcti_length_y(const rcti *rect, int y); +float BLI_rctf_length_x(const rctf *rect, float x); +float BLI_rctf_length_y(const rctf *rect, float y); bool BLI_rcti_isect_segment(const struct rcti *rect, const int s1[2], const int s2[2]); bool BLI_rctf_isect_segment(const struct rctf *rect, const float s1[2], const float s2[2]); -bool BLI_rcti_isect_circle(const struct rcti *rect, const float xy[2], const float radius); -bool BLI_rctf_isect_circle(const struct rctf *rect, const float xy[2], const float radius); +bool BLI_rcti_isect_circle(const struct rcti *rect, const float xy[2], float radius); +bool BLI_rctf_isect_circle(const struct rctf *rect, const float xy[2], float radius); bool BLI_rcti_inside_rcti(const rcti *rct_a, const rcti *rct_b); /** * is \a rct_b inside \a rct_a @@ -169,7 +166,7 @@ void BLI_rcti_rctf_copy_round(struct rcti *dst, const struct rctf *src); /** * Expand the rectangle to fit a rotated \a src. */ -void BLI_rctf_rotate_expand(rctf *dst, const rctf *src, const float angle); +void BLI_rctf_rotate_expand(rctf *dst, const rctf *src, float angle); void print_rctf(const char *str, const struct rctf *rect); void print_rcti(const char *str, const struct rcti *rect); diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index ec7fa8f27a0..eca3c00017c 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -114,10 +114,8 @@ enum { BLI_SCANFILL_CALC_LOOSE = (1 << 4), }; void BLI_scanfill_begin(ScanFillContext *sf_ctx); -unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, const int flag); -unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, - const int flag, - const float nor_proj[3]); +unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, int flag); +unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, int flag, const float nor_proj[3]); void BLI_scanfill_end(ScanFillContext *sf_ctx); void BLI_scanfill_begin_arena(ScanFillContext *sf_ctx, struct MemArena *arena); diff --git a/source/blender/blenlib/BLI_smallhash.h b/source/blender/blenlib/BLI_smallhash.h index 76009810eb9..9c274d25fba 100644 --- a/source/blender/blenlib/BLI_smallhash.h +++ b/source/blender/blenlib/BLI_smallhash.h @@ -53,7 +53,7 @@ typedef struct { unsigned int i; } SmallHashIter; -void BLI_smallhash_init_ex(SmallHash *sh, const unsigned int nentries_reserve) ATTR_NONNULL(1); +void BLI_smallhash_init_ex(SmallHash *sh, unsigned int nentries_reserve) ATTR_NONNULL(1); void BLI_smallhash_init(SmallHash *sh) ATTR_NONNULL(1); /** * \note does *not* free *sh itself! only the direct data! diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 91cc7b23a5f..a82e97914db 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -89,7 +89,7 @@ char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t */ char *BLI_strncpy_ensure_pad(char *__restrict dst, const char *__restrict src, - const char pad, + char pad, size_t maxncpy) ATTR_NONNULL(); /** @@ -306,8 +306,7 @@ size_t BLI_str_format_uint64_grouped(char dst[16], uint64_t num) ATTR_NONNULL(); * \param bytes: Number to format. * \param base_10: Calculate using base 10 (GB, MB, ...) or 2 (GiB, MiB, ...). */ -void BLI_str_format_byte_unit(char dst[15], long long int bytes, const bool base_10) - ATTR_NONNULL(); +void BLI_str_format_byte_unit(char dst[15], long long int bytes, bool base_10) ATTR_NONNULL(); /** * Format a count to up to 6 places (plus '\0' terminator) string using long number * names abbreviations. Used to produce a compact representation of large numbers. @@ -354,9 +353,8 @@ int BLI_strcasecmp_natural(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESU * Like strcmp, but will ignore any heading/trailing pad char for comparison. * So e.g. if pad is '*', '*world' and 'world*' will compare equal. */ -int BLI_strcmp_ignore_pad(const char *str1, - const char *str2, - const char pad) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +int BLI_strcmp_ignore_pad(const char *str1, const char *str2, char pad) ATTR_WARN_UNUSED_RESULT + ATTR_NONNULL(); /** * Determine the length of a fixed-size string. @@ -378,7 +376,7 @@ void BLI_str_rstrip(char *str) ATTR_NONNULL(); * \param pad: * \return The number of zeros stripped. */ -int BLI_str_rstrip_float_zero(char *str, const char pad) ATTR_NONNULL(); +int BLI_str_rstrip_float_zero(char *str, char pad) ATTR_NONNULL(); /** * Return index of a string in a string array. @@ -390,7 +388,7 @@ int BLI_str_rstrip_float_zero(char *str, const char pad) ATTR_NONNULL(); */ int BLI_str_index_in_array_n(const char *__restrict str, const char **__restrict str_array, - const int str_array_len) ATTR_NONNULL(); + int str_array_len) ATTR_NONNULL(); /** * Return index of a string in a string array. * @@ -461,14 +459,14 @@ size_t BLI_str_partition_ex(const char *str, const char delim[], const char **sep, const char **suf, - const bool from_right) ATTR_NONNULL(1, 3, 4, 5); + bool from_right) ATTR_NONNULL(1, 3, 4, 5); -int BLI_string_max_possible_word_count(const int str_len); +int BLI_string_max_possible_word_count(int str_len); bool BLI_string_has_word_prefix(const char *haystack, const char *needle, size_t needle_len); bool BLI_string_all_words_matched(const char *name, const char *str, int (*words)[2], - const int words_len); + int words_len); /** * Find the ranges needed to split \a str into its individual words. @@ -482,7 +480,7 @@ bool BLI_string_all_words_matched(const char *name, */ int BLI_string_find_split_words(const char *str, const size_t len, - const char delim, + char delim, int r_words[][2], int words_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh index dc73208350f..3769e711a50 100644 --- a/source/blender/blenlib/BLI_string_ref.hh +++ b/source/blender/blenlib/BLI_string_ref.hh @@ -64,7 +64,7 @@ class StringRefBase { const char *data_; int64_t size_; - constexpr StringRefBase(const char *data, const int64_t size); + constexpr StringRefBase(const char *data, int64_t size); public: /* Similar to string_view::npos, but signed. */ @@ -84,12 +84,12 @@ class StringRefBase { constexpr IndexRange index_range() const; void unsafe_copy(char *dst) const; - void copy(char *dst, const int64_t dst_size) const; + void copy(char *dst, int64_t dst_size) const; template<size_t N> void copy(char (&dst)[N]) const; constexpr bool startswith(StringRef prefix) const; constexpr bool endswith(StringRef suffix) const; - constexpr StringRef substr(int64_t start, const int64_t size) const; + constexpr StringRef substr(int64_t start, int64_t size) const; constexpr const char &front() const; constexpr const char &back() const; @@ -123,11 +123,11 @@ class StringRefNull : public StringRefBase { public: constexpr StringRefNull(); - constexpr StringRefNull(const char *str, const int64_t size); + constexpr StringRefNull(const char *str, int64_t size); StringRefNull(const char *str); StringRefNull(const std::string &str); - constexpr char operator[](const int64_t index) const; + constexpr char operator[](int64_t index) const; constexpr const char *c_str() const; }; @@ -139,14 +139,14 @@ class StringRef : public StringRefBase { constexpr StringRef(); constexpr StringRef(StringRefNull other); constexpr StringRef(const char *str); - constexpr StringRef(const char *str, const int64_t length); + constexpr StringRef(const char *str, int64_t length); constexpr StringRef(const char *begin, const char *one_after_end); constexpr StringRef(std::string_view view); StringRef(const std::string &str); - constexpr StringRef drop_prefix(const int64_t n) const; + constexpr StringRef drop_prefix(int64_t n) const; constexpr StringRef drop_known_prefix(StringRef prefix) const; - constexpr StringRef drop_suffix(const int64_t n) const; + constexpr StringRef drop_suffix(int64_t n) const; constexpr char operator[](int64_t index) const; }; diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index 72bddb322db..82622d442fb 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -202,8 +202,7 @@ size_t BLI_str_partition_ex_utf8(const char *str, const unsigned int delim[], const char **sep, const char **suf, - const bool from_right) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(1, 3, 4, 5); + bool from_right) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 3, 4, 5); int BLI_str_utf8_offset_to_index(const char *str, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); diff --git a/source/blender/blenlib/BLI_string_utils.h b/source/blender/blenlib/BLI_string_utils.h index ce4d0afb933..fd3918ff217 100644 --- a/source/blender/blenlib/BLI_string_utils.h +++ b/source/blender/blenlib/BLI_string_utils.h @@ -50,7 +50,7 @@ typedef bool (*UniquenameCheckCallback)(void *arg, const char *name); * \param delim: Delimiter character`. * \return Length of \a left. */ -size_t BLI_split_name_num(char *left, int *nr, const char *name, const char delim); +size_t BLI_split_name_num(char *left, int *nr, const char *name, char delim); bool BLI_string_is_decimal(const char *string) ATTR_NONNULL(); /** @@ -126,7 +126,7 @@ char *BLI_string_join_array_by_sep_char_with_tableN(char sep, */ size_t BLI_string_flip_side_name(char *r_name, const char *from_name, - const bool strip_number, + bool strip_number, const size_t name_len); /** diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index 616237bc261..e487f8acd98 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -157,7 +157,7 @@ typedef struct TaskParallelTLS { } TaskParallelTLS; typedef void (*TaskParallelRangeFunc)(void *__restrict userdata, - const int iter, + int iter, const TaskParallelTLS *__restrict tls); typedef void (*TaskParallelInitFunc)(const void *__restrict userdata, void *__restrict chunk); @@ -210,8 +210,8 @@ typedef struct TaskParallelSettings { BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings); -void BLI_task_parallel_range(const int start, - const int stop, +void BLI_task_parallel_range(int start, + int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings); @@ -262,8 +262,8 @@ typedef void (*TaskParallelIteratorFunc)(void *__restrict userdata, void BLI_task_parallel_iterator(void *userdata, TaskParallelIteratorIterFunc iter_func, void *init_item, - const int init_index, - const int tot_items, + int init_index, + int tot_items, TaskParallelIteratorFunc func, const TaskParallelSettings *settings); diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h index 7bae16f25ef..c7aae6d7972 100644 --- a/source/blender/blenlib/BLI_threads.h +++ b/source/blender/blenlib/BLI_threads.h @@ -167,7 +167,7 @@ typedef pthread_cond_t ThreadCondition; void BLI_condition_init(ThreadCondition *cond); void BLI_condition_wait(ThreadCondition *cond, ThreadMutex *mutex); -void BLI_condition_wait_global_mutex(ThreadCondition *cond, const int type); +void BLI_condition_wait_global_mutex(ThreadCondition *cond, int type); void BLI_condition_notify_one(ThreadCondition *cond); void BLI_condition_notify_all(ThreadCondition *cond); void BLI_condition_end(ThreadCondition *cond); diff --git a/source/blender/blenlib/BLI_timecode.h b/source/blender/blenlib/BLI_timecode.h index 4eec8aef245..f0349e289ac 100644 --- a/source/blender/blenlib/BLI_timecode.h +++ b/source/blender/blenlib/BLI_timecode.h @@ -43,10 +43,10 @@ extern "C" { */ size_t BLI_timecode_string_from_time(char *str, const size_t maxncpy, - const int brevity_level, - const float time_seconds, - const double fps, - const short timecode_style) ATTR_NONNULL(); + int brevity_level, + float time_seconds, + double fps, + short timecode_style) ATTR_NONNULL(); /** * Generate time string and store in \a str @@ -56,9 +56,8 @@ size_t BLI_timecode_string_from_time(char *str, * \param time_seconds: time total time in seconds * \return length of \a str */ -size_t BLI_timecode_string_from_time_simple(char *str, - const size_t maxncpy, - const double time_seconds) ATTR_NONNULL(); +size_t BLI_timecode_string_from_time_simple(char *str, const size_t maxncpy, double time_seconds) + ATTR_NONNULL(); /** * Generate time string and store in \a str @@ -74,8 +73,8 @@ size_t BLI_timecode_string_from_time_simple(char *str, */ size_t BLI_timecode_string_from_time_seconds(char *str, const size_t maxncpy, - const int brevity_level, - const float time_seconds) ATTR_NONNULL(); + int brevity_level, + float time_seconds) ATTR_NONNULL(); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh index 86ac95e2c77..231ce1bdd67 100644 --- a/source/blender/blenlib/BLI_virtual_array.hh +++ b/source/blender/blenlib/BLI_virtual_array.hh @@ -79,7 +79,7 @@ template<typename T> class VArrayImpl { * Get the element at #index. This does not return a reference, because the value may be computed * on the fly. */ - virtual T get(const int64_t index) const = 0; + virtual T get(int64_t index) const = 0; /** * Return true when the virtual array is a plain array internally. @@ -202,7 +202,7 @@ template<typename T> class VMutableArrayImpl : public VArrayImpl<T> { /** * Assign the provided #value to the #index. */ - virtual void set(const int64_t index, T value) = 0; + virtual void set(int64_t index, T value) = 0; /** * Copy all elements from the provided span into the virtual array. diff --git a/source/blender/blenlib/BLI_virtual_vector_array.hh b/source/blender/blenlib/BLI_virtual_vector_array.hh index 7672a76d5de..7960c6b1420 100644 --- a/source/blender/blenlib/BLI_virtual_vector_array.hh +++ b/source/blender/blenlib/BLI_virtual_vector_array.hh @@ -82,9 +82,9 @@ template<typename T> class VVectorArray { } protected: - virtual int64_t get_vector_size_impl(const int64_t index) const = 0; + virtual int64_t get_vector_size_impl(int64_t index) const = 0; - virtual T get_vector_element_impl(const int64_t index, const int64_t index_in_vetor) const = 0; + virtual T get_vector_element_impl(int64_t index, int64_t index_in_vetor) const = 0; virtual bool is_single_vector_impl() const { diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index 568734ee8a7..2ea557e971a 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -106,7 +106,7 @@ const char *dirname(char *path); /* Windows utility functions. */ -bool BLI_windows_register_blend_extension(const bool background); +bool BLI_windows_register_blend_extension(bool background); void BLI_windows_get_default_root_dir(char root_dir[4]); int BLI_windows_get_executable_dir(char *str); diff --git a/source/blender/blenlib/intern/kdtree_impl.h b/source/blender/blenlib/intern/kdtree_impl.h index 0b47be1f7ea..c0e740b39b3 100644 --- a/source/blender/blenlib/intern/kdtree_impl.h +++ b/source/blender/blenlib/intern/kdtree_impl.h @@ -594,7 +594,7 @@ int BLI_kdtree_nd_(find_nearest_n_with_len_squared_cb)( int BLI_kdtree_nd_(find_nearest_n)(const KDTree *tree, const float co[KD_DIMS], KDTreeNearest r_nearest[], - const uint nearest_len_capacity) + uint nearest_len_capacity) { return BLI_kdtree_nd_(find_nearest_n_with_len_squared_cb)( tree, co, r_nearest, nearest_len_capacity, NULL, NULL); @@ -726,7 +726,7 @@ int BLI_kdtree_nd_(range_search_with_len_squared_cb)( int BLI_kdtree_nd_(range_search)(const KDTree *tree, const float co[KD_DIMS], KDTreeNearest **r_nearest, - const float range) + float range) { return BLI_kdtree_nd_(range_search_with_len_squared_cb)(tree, co, r_nearest, range, NULL, NULL); } |