[Bf-blender-cvs] [3d3e5ae] soc-2016-uv_tools: Lots of fixes for warnings
Phil Gosch
noreply at git.blender.org
Tue Aug 23 15:34:26 CEST 2016
Commit: 3d3e5ae3fd42f5ec437c8d55c0983a4b4332257b
Author: Phil Gosch
Date: Tue Aug 23 15:33:54 2016 +0200
Branches: soc-2016-uv_tools
https://developer.blender.org/rB3d3e5ae3fd42f5ec437c8d55c0983a4b4332257b
Lots of fixes for warnings
===================================================================
M source/blender/editors/uvedit/uvedit_parametrizer.c
M source/blender/editors/uvedit/uvedit_unwrap_ops.c
===================================================================
diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c
index d7ec3ab..63aa8d1 100644
--- a/source/blender/editors/uvedit/uvedit_parametrizer.c
+++ b/source/blender/editors/uvedit/uvedit_parametrizer.c
@@ -674,7 +674,7 @@ static PBool p_intersect_line_segments_2d(float *a, float *b, float *c, float *d
return P_FALSE;
}
-bool p_rect_intersect(float min1[2], float max1[2], float min2[2], float max2[2])
+static bool p_rect_intersect(float min1[2], float max1[2], float min2[2], float max2[2])
{
if (min1[0] > max2[0] ||
max1[0] < min2[0] ||
@@ -687,14 +687,14 @@ bool p_rect_intersect(float min1[2], float max1[2], float min2[2], float max2[2]
}
/* Returns the interval of range in which f falls in */
-int p_float_to_int_range(float f, int range)
+static int p_float_to_int_range(float f, int range)
{
return (int)(f * (float)(range));
}
/* Returns the interval of range in which f falls in */
/* re contains the remainder of f, linearized to 0-1 range */
-int p_float_to_int_range_remainder(float f, int range, float *re)
+static int p_float_to_int_range_remainder(float f, int range, float *re)
{
int val = p_float_to_int_range(f, range);
*re = f * range - val;
@@ -4861,7 +4861,7 @@ void param_pack(ParamHandle *handle, float margin, bool do_rotate)
/* qsort function - sort largest to smallest */
static int vert_anglesort(const void *p1, const void *p2)
{
- const PVert **v1 = p1, **v2 = p2;
+ PVert **v1 = p1, **v2 = p2;
const float a1 = (*v1)->edge->u.horizontal_angle;
const float a2 = (*v2)->edge->u.horizontal_angle;
@@ -4873,7 +4873,7 @@ static int vert_anglesort(const void *p1, const void *p2)
/* qsort function - sort largest to smallest */
static int point_anglesort(const void *p1, const void *p2)
{
- const PPointUV **v1 = p1, **v2 = p2;
+ PPointUV **v1 = p1, **v2 = p2;
const float a1 = (*v1)->angle;
const float a2 = (*v2)->angle;
@@ -4885,7 +4885,7 @@ static int point_anglesort(const void *p1, const void *p2)
/* qsort function - sort largest to smallest */
static int chart_areasort(const void *p1, const void *p2)
{
- const PChart **c1 = p1, **c2 = p2;
+ PChart **c1 = p1, **c2 = p2;
const float a1 = (*c1)->u.ipack.area;
const float a2 = (*c2)->u.ipack.area;
@@ -4937,7 +4937,7 @@ static float p_edge_horizontal_angle_ppointuv(PPointUV *a, PPointUV *b)
}
/* ToDo SaphireS: Put ConvexHull/NFP stuff in own file*/
-PConvexHull *p_convex_hull_new(PChart *chart)
+static PConvexHull *p_convex_hull_new(PChart *chart)
{
PConvexHull *conv_hull = (PConvexHull *)MEM_callocN(sizeof(*conv_hull), "PConvexHull");
PVert **points;
@@ -4982,7 +4982,7 @@ PConvexHull *p_convex_hull_new(PChart *chart)
return conv_hull;
}
-PConvexHull *p_convex_hull_new_tri(PChart *chart, const float (*coords)[2])
+static PConvexHull *p_convex_hull_new_tri(PChart *chart, const float(*coords)[2])
{
PConvexHull *conv_hull = (PConvexHull *)MEM_callocN(sizeof(*conv_hull), "PConvexHull");
PVert *v;
@@ -5056,7 +5056,7 @@ PConvexHull *p_convex_hull_new_tri(PChart *chart, const float (*coords)[2])
}
/* Update bounds and recalculate ref vertex (highest y value) */
-void p_convex_hull_update(PConvexHull *conv_hull, bool update_points)
+static void p_convex_hull_update(PConvexHull *conv_hull, bool update_points)
{
int i;
float maxy = -1.0e30f, p[2];
@@ -5092,7 +5092,7 @@ void p_convex_hull_update(PConvexHull *conv_hull, bool update_points)
}
}
-void p_convex_hull_delete(PConvexHull *c_hull, bool decomposed)
+static void p_convex_hull_delete(PConvexHull *c_hull)
{
int i;
for (i = 0; i < c_hull->nverts; i++) {
@@ -5100,14 +5100,6 @@ void p_convex_hull_delete(PConvexHull *c_hull, bool decomposed)
MEM_freeN(c_hull->verts[i]);
}
}
-
- /*if (decomposed) {
- for (j = 0; j < 3; j++) {
- if (c_hull->h_verts[j]) {
- MEM_freeN(c_hull->h_verts[j]);
- }
- }
- }*/
MEM_freeN(c_hull->verts);
MEM_freeN(c_hull->h_verts);
@@ -5115,7 +5107,7 @@ void p_convex_hull_delete(PConvexHull *c_hull, bool decomposed)
c_hull = NULL;
}
-bool p_convex_hull_intersect(PConvexHull *chull_a, PConvexHull *chull_b)
+static bool p_convex_hull_intersect(PConvexHull *chull_a, PConvexHull *chull_b)
{
/* Preliminary bounds check */
if (!p_rect_intersect(chull_a->min_v, chull_a->max_v, chull_b->min_v, chull_b->max_v)) {
@@ -5140,7 +5132,7 @@ bool p_convex_hull_intersect(PConvexHull *chull_a, PConvexHull *chull_b)
return false;
}
-void p_convex_hull_compute_horizontal_angles(PConvexHull *hull)
+static void p_convex_hull_compute_horizontal_angles(PConvexHull *hull)
{
int j;
printf("*p_convex_hull_compute_horizontal_angles\n");
@@ -5170,7 +5162,7 @@ void p_convex_hull_compute_horizontal_angles(PConvexHull *hull)
}
}
-void p_convex_hull_compute_edge_components(PConvexHull *hull)
+static void p_convex_hull_compute_edge_components(PConvexHull *hull)
{
int j;
printf("*p_convex_hull_compute_edge_lengths\n");
@@ -5200,7 +5192,7 @@ void p_convex_hull_compute_edge_components(PConvexHull *hull)
}
}
-PConvexHull *p_convex_hull_reverse_vert_order(PConvexHull *hull)
+static PConvexHull *p_convex_hull_reverse_vert_order(PConvexHull *hull)
{
PConvexHull *conv_hull_inv = (PConvexHull *)MEM_callocN(sizeof(*conv_hull_inv), "PConvexHullInverse");
conv_hull_inv->nverts = hull->nverts;
@@ -5209,7 +5201,7 @@ PConvexHull *p_convex_hull_reverse_vert_order(PConvexHull *hull)
conv_hull_inv->right = hull->right;
conv_hull_inv->placed = false;
int i, j;
- float miny = 1.0e30f, p[2];
+ float miny = 1.0e30f, b[2];
/* reverse vert order */
for (j = 0; j < hull->nverts; j++) {
@@ -5242,9 +5234,9 @@ PConvexHull *p_convex_hull_reverse_vert_order(PConvexHull *hull)
}
/* compute bounds */
- p[0] = conv_hull_inv->verts[i]->x;
- p[1] = conv_hull_inv->verts[i]->y;
- minmax_v2v2_v2(conv_hull_inv->min_v, conv_hull_inv->max_v, p);
+ b[0] = conv_hull_inv->verts[i]->x;
+ b[1] = conv_hull_inv->verts[i]->y;
+ minmax_v2v2_v2(conv_hull_inv->min_v, conv_hull_inv->max_v, b);
}
printf("--p_convex_hull_reverse_vert_order: FINAL min_y: x: %f, y: %f\n", conv_hull_inv->verts[conv_hull_inv->ref_vert_index]->x, conv_hull_inv->verts[conv_hull_inv->ref_vert_index]->y);
@@ -5253,7 +5245,7 @@ PConvexHull *p_convex_hull_reverse_vert_order(PConvexHull *hull)
}
/* Grow hull by margin amount */
-void p_convex_hull_grow(PConvexHull *chull, float margin)
+static void p_convex_hull_grow(PConvexHull *chull, float margin)
{
/* ToDo SaphireS */
PVert *v1, *v2, *v3;
@@ -5320,7 +5312,7 @@ void p_convex_hull_grow(PConvexHull *chull, float margin)
}
}
-PConvexHull *p_convex_hull_reverse_direction(PConvexHull *item)
+static PConvexHull *p_convex_hull_reverse_direction(PConvexHull *item)
{
/* Invert direction of one convex hull -> CCW */
printf("inversing direction start\n");
@@ -5336,7 +5328,7 @@ PConvexHull *p_convex_hull_reverse_direction(PConvexHull *item)
}
/* ToDo SaphireS: store edge angle/edge components in different way so this isn't necessary */
-void p_convex_hull_restore_direction(PConvexHull *item, float margin)
+static void p_convex_hull_restore_direction(PConvexHull *item, float margin)
{
p_convex_hull_update(item, true);
p_convex_hull_grow(item, margin);
@@ -5345,7 +5337,7 @@ void p_convex_hull_restore_direction(PConvexHull *item, float margin)
p_convex_hull_compute_edge_components(item);
}
-PNoFitPolygon *p_inner_fit_polygon_create(PConvexHull *item)
+static PNoFitPolygon *p_inner_fit_polygon_create(PConvexHull *item)
{
PNoFitPolygon *nfp = (PNoFitPolygon *)MEM_callocN(sizeof(*nfp), "PNoFitPolygon");
/* Simplification, since we're not dealing with arbitrary shaped outer bounds */
@@ -5387,7 +5379,7 @@ PNoFitPolygon *p_inner_fit_polygon_create(PConvexHull *item)
return nfp;
}
-PConvexHull** p_decompose_triangulate_chart(PChart *chart, const float (*hull_points)[2], const int nbounds)
+static PConvexHull** p_decompose_triangulate_chart(PChart *chart, const float(*hull_points)[2], const int nbounds)
{
int i, ntris = nbounds - 2;
unsigned int(*r_tris)[3] = BLI_array_alloca(r_tris, ntris);
@@ -5421,7 +5413,7 @@ PConvexHull** p_decompose_triangulate_chart(PChart *chart, const float (*hull_po
return chull_tris;
}
-bool p_point_inside_nfp(PNoFitPolygon *nfp, float p[2])
+static bool p_point_inside_nfp(PNoFitPolygon *nfp, float p[2])
{
/* raycast to the right of vert, odd number of intersections means inside */
int i, j, c = 0;
@@ -5435,7 +5427,7 @@ bool p_point_inside_nfp(PNoFitPolygon *nfp, float p[2])
return c;
}
-bool p_is_concave(PChart *chart, const float(*hull_points)[2], int nboundaries)
+static bool p_is_concave(PChart *chart, const float(*hull_points)[2], int nboundaries)
{
if (nboundaries <= 4) {
printf("<= 4 boundary edges, convex\n");
@@ -5453,10 +5445,14 @@ bool p_is_concave(PChart *chart, const float(*hull_points)[2], int nboundaries)
}
}
-bool p_temp_cfr_check(PNoFitPolygon **nfps, PNoFitPolygon *ifp, float p[2], int nfp_count, int index)
+static bool p_temp_cfr_check(PNoFitPolygon **nfps, PNoFitPolygon *ifp, PPointUV *pp, int nfp_count, int index)
{
+ float v1[2], v2[2], v3[2], p[2];
int i;
+ p[0] = pp->x;
+ p[1] = pp->y;
+
/* Make sure point is inside IFP */
if (p[0] < ifp->final_pos[0]->x ||
p[1] < ifp->final_pos[0]->y ||
@@ -5470,9 +5466,19 @@ bool p_temp_cfr_check(PNoFitPolygon **nfps, PNoFitPolygon *ifp, float p[2], int
for (i = 0; i < nfp_count; i++) {
if (nfps[i] && (i != index)) {
if (nfps[i]->nverts == 3) {
- if (p_triangle_inside_v3_v2(nfps[i]->final_pos[0],
+ v1[0] = nfps[i]->final_pos[0]->x;
+ v1[1] = nfps[i]->final_pos[0]->y;
+
+ v2[0] = nfps[i]->final_pos[1]->x;
+ v2[1] = nfps[i]->final_pos[1]->y;
+
+ v3[0] = nfps[i]->final_pos[2]->x;
+ v3[1] = nfps[i]->final_pos[2]->y;
+
+ /*if (p_triangle_inside_v3_v2(nfps[i]->final_pos[0],
nfps[i]->final_pos[1],
- nfps[i]->final_pos[2], p)) {
+ nfps[i]->final_pos[2], p)) {*/
+ if (p_triangle_inside_v3_v2(v1, v2, v3, p)) {
/*printf("--end_pos x: %f y: %f is inside nfps[%i]!\n", p[0], p[1], i);*/
return false;
}
@@ -5491,7 +5497,7 @@ bool
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list