Cleanup: use bool and const args

This commit is contained in:
Campbell Barton
2014-10-09 22:39:59 +02:00
parent ad4980ce5e
commit 30dab51c29
9 changed files with 52 additions and 38 deletions

View File

@@ -89,9 +89,10 @@ void BKE_pbvh_search_gather(PBVH *bvh,
* it's up to the callback to find the primitive within the leaves that is
* hit first */
void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
const float ray_start[3], const float ray_normal[3],
int original);
void BKE_pbvh_raycast(
PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
const float ray_start[3], const float ray_normal[3],
bool original);
bool BKE_pbvh_node_raycast(PBVH *bvh, PBVHNode *node, float (*origco)[3], int use_origco,
const float ray_start[3], const float ray_normal[3],

View File

@@ -1433,7 +1433,7 @@ void BKE_pbvh_node_get_proxies(PBVHNode *node, PBVHProxyNode **proxies, int *pro
typedef struct {
IsectRayAABBData ray;
int original;
bool original;
} RaycastData;
static bool ray_aabb_intersect(PBVHNode *node, void *data_v)
@@ -1449,9 +1449,10 @@ static bool ray_aabb_intersect(PBVHNode *node, void *data_v)
return isect_ray_aabb(&rcd->ray, bb_min, bb_max, &node->tmin);
}
void BKE_pbvh_raycast(PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
const float ray_start[3], const float ray_normal[3],
int original)
void BKE_pbvh_raycast(
PBVH *bvh, BKE_pbvh_HitOccludedCallback cb, void *data,
const float ray_start[3], const float ray_normal[3],
bool original)
{
RaycastData rcd;

View File

@@ -275,17 +275,22 @@ void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f
/********************************** Normals **********************************/
void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
float n4[3], const float f_no[3], const float co1[3], const float co2[3],
const float co3[3], const float co4[3]);
void accumulate_vertex_normals(
float n1[3], float n2[3], float n3[3], float n4[3],
const float f_no[3],
const float co1[3], const float co2[3], const float co3[3], const float co4[3]);
void accumulate_vertex_normals_poly(float **vertnos, const float polyno[3],
const float **vertcos, float vdiffs[][3], const int nverts);
void accumulate_vertex_normals_poly(
float **vertnos, const float polyno[3],
const float **vertcos, float vdiffs[][3], const int nverts);
/********************************* Tangents **********************************/
void tangent_from_uv(float uv1[2], float uv2[2], float uv3[2],
float co1[3], float co2[3], float co3[3], float n[3], float tang[3]);
void tangent_from_uv(
const float uv1[2], const float uv2[2], const float uv3[2],
const float co1[3], const float co2[3], const float co3[3],
const float n[3],
float r_tang[3]);
/******************************** Vector Clouds ******************************/

View File

@@ -3231,9 +3231,10 @@ void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const f
/********************************* Normals **********************************/
void accumulate_vertex_normals(float n1[3], float n2[3], float n3[3],
float n4[3], const float f_no[3], const float co1[3], const float co2[3],
const float co3[3], const float co4[3])
void accumulate_vertex_normals(
float n1[3], float n2[3], float n3[3], float n4[3],
const float f_no[3],
const float co1[3], const float co2[3], const float co3[3], const float co4[3])
{
float vdiffs[4][3];
const int nverts = (n4 != NULL && co4 != NULL) ? 4 : 3;
@@ -3305,7 +3306,11 @@ void accumulate_vertex_normals_poly(float **vertnos, const float polyno[3],
/********************************* Tangents **********************************/
void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], float co2[3], float co3[3], float n[3], float tang[3])
void tangent_from_uv(
const float uv1[2], const float uv2[2], const float uv3[3],
const float co1[3], const float co2[3], const float co3[3],
const float n[3],
float r_tang[3])
{
const float s1 = uv2[0] - uv1[0];
const float s2 = uv3[0] - uv1[0];
@@ -3313,7 +3318,8 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], flo
const float t2 = uv3[1] - uv1[1];
float det = (s1 * t2 - s2 * t1);
if (det != 0.0f) { /* otherwise 'tang' becomes nan */
/* otherwise 'r_tang' becomes nan */
if (det != 0.0f) {
float tangv[3], ct[3], e1[3], e2[3];
det = 1.0f / det;
@@ -3321,21 +3327,21 @@ void tangent_from_uv(float uv1[2], float uv2[2], float uv3[3], float co1[3], flo
/* normals in render are inversed... */
sub_v3_v3v3(e1, co1, co2);
sub_v3_v3v3(e2, co1, co3);
tang[0] = (t2 * e1[0] - t1 * e2[0]) * det;
tang[1] = (t2 * e1[1] - t1 * e2[1]) * det;
tang[2] = (t2 * e1[2] - t1 * e2[2]) * det;
r_tang[0] = (t2 * e1[0] - t1 * e2[0]) * det;
r_tang[1] = (t2 * e1[1] - t1 * e2[1]) * det;
r_tang[2] = (t2 * e1[2] - t1 * e2[2]) * det;
tangv[0] = (s1 * e2[0] - s2 * e1[0]) * det;
tangv[1] = (s1 * e2[1] - s2 * e1[1]) * det;
tangv[2] = (s1 * e2[2] - s2 * e1[2]) * det;
cross_v3_v3v3(ct, tang, tangv);
cross_v3_v3v3(ct, r_tang, tangv);
/* check flip */
if (dot_v3v3(ct, n) < 0.0f) {
negate_v3(tang);
negate_v3(r_tang);
}
}
else {
tang[0] = tang[1] = tang[2] = 0.0f;
zero_v3(r_tang);
}
}

View File

@@ -294,9 +294,10 @@ finally:
* \param use_tag Only bisect tagged edges and faces.
* \param oflag_center Operator flag, enabled for geometry on the axis (existing and created)
*/
void BM_mesh_bisect_plane(BMesh *bm, float plane[4],
const bool use_snap_center, const bool use_tag,
const short oflag_center, const float eps)
void BM_mesh_bisect_plane(
BMesh *bm, const float plane[4],
const bool use_snap_center, const bool use_tag,
const short oflag_center, const float eps)
{
unsigned int einput_len;
unsigned int i;

View File

@@ -27,8 +27,9 @@
* \ingroup bmesh
*/
void BM_mesh_bisect_plane(BMesh *bm, float plane[4],
const bool use_snap_center, const bool use_tag,
const short oflag_center, const float eps);
void BM_mesh_bisect_plane(
BMesh *bm, const float plane[4],
const bool use_snap_center, const bool use_tag,
const short oflag_center, const float eps);
#endif /* __BMESH_BISECT_PLANE_H__ */

View File

@@ -8747,8 +8747,9 @@ static int ui_handler_pie(bContext *C, const wmEvent *event, uiPopupBlockHandle
switch (event->type) {
case MOUSEMOVE:
if (len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ &&
!is_click_style) {
if (!is_click_style &&
(len_squared_v2v2(event_xy, block->pie_data.pie_center_init) > PIE_CLICK_THRESHOLD_SQ))
{
block->pie_data.flags |= UI_PIE_DRAG_STYLE;
}
ui_handle_menu_button(C, event, menu);

View File

@@ -268,8 +268,8 @@ typedef struct {
/* Original coordinate, normal, and mask */
const float *co;
float mask;
const short *no;
float mask;
} SculptOrigVertData;
@@ -4008,7 +4008,7 @@ typedef struct {
const float *ray_start, *ray_normal;
bool hit;
float dist;
int original;
bool original;
} SculptRaycastData;
typedef struct {

View File

@@ -434,9 +434,7 @@ static SpaceLink *view3d_duplicate(SpaceLink *sl)
BGpic *bgpic;
/* clear or remove stuff from old */
// XXX BIF_view3d_previewrender_free(v3do);
if (v3dn->localvd) {
v3dn->localvd = NULL;
v3dn->properties_storage = NULL;