[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39573] branches/bmesh/blender/source/ blender: fix for rna type getting an boolean as an int, and gcc' s -Wdouble-promotion
Campbell Barton
ideasman42 at gmail.com
Sat Aug 20 22:19:58 CEST 2011
Revision: 39573
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39573
Author: campbellbarton
Date: 2011-08-20 20:19:58 +0000 (Sat, 20 Aug 2011)
Log Message:
-----------
fix for rna type getting an boolean as an int, and gcc's -Wdouble-promotion
Modified Paths:
--------------
branches/bmesh/blender/source/blender/blenlib/intern/math_vector_inline.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
branches/bmesh/blender/source/blender/bmesh/intern/bmesh_polygon.c
branches/bmesh/blender/source/blender/bmesh/operators/bevel.c
branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c
branches/bmesh/blender/source/blender/bmesh/operators/createops.c
branches/bmesh/blender/source/blender/bmesh/operators/join_triangles.c
branches/bmesh/blender/source/blender/bmesh/operators/mirror.c
branches/bmesh/blender/source/blender/bmesh/operators/primitiveops.c
branches/bmesh/blender/source/blender/bmesh/operators/subdivideop.c
branches/bmesh/blender/source/blender/bmesh/operators/utils.c
branches/bmesh/blender/source/blender/editors/mesh/bmesh_tools.c
branches/bmesh/blender/source/blender/modifiers/intern/MOD_ngoninterp.c
Modified: branches/bmesh/blender/source/blender/blenlib/intern/math_vector_inline.c
===================================================================
--- branches/bmesh/blender/source/blender/blenlib/intern/math_vector_inline.c 2011-08-20 20:19:35 UTC (rev 39572)
+++ branches/bmesh/blender/source/blender/blenlib/intern/math_vector_inline.c 2011-08-20 20:19:58 UTC (rev 39573)
@@ -440,7 +440,7 @@
/* a larger value causes normalize errors in a
scaled down models with camera xtreme close */
- if(d > 1.0e-35f) {
+ if(d > 1.0e-35) {
double mul;
d= sqrt(d);
Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c 2011-08-20 20:19:35 UTC (rev 39572)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c 2011-08-20 20:19:58 UTC (rev 39573)
@@ -379,7 +379,8 @@
/*computer center*/
l2 = bm_firstfaceloop(l->f);
do {
- VECADD2(cent, l2->v->co);
+ cent[0] += (double)l2->v->co[0];
+ cent[1] += (double)l2->v->co[1];
l2 = l2->next;
} while (l2 != bm_firstfaceloop(l->f));
@@ -428,9 +429,9 @@
int i;
for (i=0; i<2; i++) {
- if (fabs(aa[i]) < FLT_EPSILON*100)
+ if (fabsf(aa[i]) < FLT_EPSILON*100)
return aa[(i+1)%2] / fabs(bb[(i+1)%2] - aa[(i+1)%2]);
- if (fabs(cc[i]) < FLT_EPSILON*100)
+ if (fabsf(cc[i]) < FLT_EPSILON*100)
return cc[(i+1)%2] / fabs(dd[(i+1)%2] - cc[(i+1)%2]);
}
}
@@ -490,9 +491,9 @@
double v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3];
double eps = FLT_EPSILON*4000;
- if (len_v3(l->v->no) == 0.0)
+ if (len_v3(l->v->no) == 0.0f)
BM_Vert_UpdateAllNormals(bm, l->v);
- if (len_v3(tl->v->no) == 0.0)
+ if (len_v3(tl->v->no) == 0.0f)
BM_Vert_UpdateAllNormals(bm, tl->v);
compute_mdisp_quad(tl, v1, v2, v3, v4, e1, e2);
@@ -545,7 +546,7 @@
}
res = (int)sqrt(mdisps->totdisp);
- d = 1.0f/(double)(res-1);
+ d = 1.0/(double)(res-1);
for (x=0.0f, ix=0; ix<res; x += d, ix++) {
for (y=0.0f, iy=0; iy<res; y+= d, iy++) {
double co1[3], co2[3], co[3];
@@ -553,8 +554,8 @@
VECCOPY(co1, e1);
- if (!iy) yy = y + FLT_EPSILON*20;
- else yy = y - FLT_EPSILON*20;
+ if (!iy) yy = y + (double)FLT_EPSILON*20;
+ else yy = y - (double)FLT_EPSILON*20;
VECMUL(co1, y);
VECADD2(co1, v1);
@@ -563,8 +564,8 @@
VECMUL(co2, y);
VECADD2(co2, v4);
- if (!ix) xx = x + FLT_EPSILON*20;
- else xx = x - FLT_EPSILON*20;
+ if (!ix) xx = x + (double)FLT_EPSILON*20;
+ else xx = x - (double)FLT_EPSILON*20;
VECSUB(co, co2, co1);
VECMUL(co, x);
Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c 2011-08-20 20:19:35 UTC (rev 39572)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_marking.c 2011-08-20 20:19:58 UTC (rev 39573)
@@ -415,9 +415,9 @@
we cant make a crossvec from a vec thats the same as the vec
unlikely but possible, so make sure if the normal is (0,0,1)
that vec isnt the same or in the same direction even.*/
- if (eve->no[0]<0.5) vec[0]=1;
- else if (eve->no[1]<0.5) vec[1]=1;
- else vec[2]=1;
+ if (eve->no[0] < 0.5f) vec[0]= 1.0f;
+ else if (eve->no[1] < 0.5f) vec[1]= 1.0f;
+ else vec[2]= 1.0f;
cross_v3_v3v3(plane, eve->no, vec);
}
} else if (ese->type==BM_EDGE) {
@@ -443,9 +443,9 @@
we cant make a crossvec from a vec thats the same as the vec
unlikely but possible, so make sure if the normal is (0,0,1)
that vec isnt the same or in the same direction even.*/
- if (efa->no[0]<0.5) vec[0]=1.0f;
- else if (efa->no[1]<0.5) vec[1]=1.0f;
- else vec[2]=1.0f;
+ if (efa->no[0] < 0.5f) vec[0]= 1.0f;
+ else if (efa->no[1] < 0.5f) vec[1]= 1.0f;
+ else vec[2]= 1.0f;
cross_v3_v3v3(plane, efa->no, vec);
#if 0 //BMESH_TODO
Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c 2011-08-20 20:19:35 UTC (rev 39572)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c 2011-08-20 20:19:58 UTC (rev 39573)
@@ -227,7 +227,7 @@
if (BM_TestHFlag(v, BM_HIDDEN))
continue;
- if (normalize_v3(v->no)==0.0) {
+ if (normalize_v3(v->no) == 0.0f) {
copy_v3_v3(v->no, v->co);
normalize_v3(v->no);
}
Modified: branches/bmesh/blender/source/blender/bmesh/intern/bmesh_polygon.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/intern/bmesh_polygon.c 2011-08-20 20:19:35 UTC (rev 39572)
+++ branches/bmesh/blender/source/blender/bmesh/intern/bmesh_polygon.c 2011-08-20 20:19:58 UTC (rev 39573)
@@ -281,18 +281,18 @@
v2 = verts[(i+1) % nverts];
v3 = verts[(i+2) % nverts];
normal_tri_v3( norm,v1, v2, v3);
-
- avgn[0] += norm[0];
- avgn[1] += norm[1];
- avgn[2] += norm[2];
+
+ add_v3_v3(avgn, norm);
}
/*what was this bit for?*/
- if(avgn[0] == 0.0 && avgn[1] == 0.0 && avgn[2] == 0.0){
- avgn[0] = 0.0;
- avgn[1] = 0.0;
- avgn[2] = 1.0;
+ if(avgn[0] == 0.0f && avgn[1] == 0.0f && avgn[2] == 0.0f) {
+ avgn[0] = 0.0f;
+ avgn[1] = 0.0f;
+ avgn[2] = 1.0f;
} else {
+ /* XXX, why is this being divided and _then_ normalized
+ * division could be removed? - campbell */
avgn[0] /= nverts;
avgn[1] /= nverts;
avgn[2] /= nverts;
@@ -375,9 +375,9 @@
cross_v3_v3v3(axis, normal, up);
- angle = saacos(normal[0]*up[0]+normal[1]*up[1] + normal[2]*up[2]);
+ angle = saacos(dot_v3v3(normal, up));
- if (angle == 0.0f) return;
+ if (angle == 0.0) return;
axis_angle_to_quat(q, axis, (float)angle);
quat_to_mat3(mat, q);
@@ -598,7 +598,7 @@
float co2[3], cent[3] = {0.0f, 0.0f}, out[3] = {FLT_MAX*0.5f, FLT_MAX*0.5f, 0};
BMLoop *l;
int crosses = 0;
- float eps = 1.0+FLT_EPSILON*150;
+ float eps = 1.0f+(float)FLT_EPSILON*150.0f;
if (dot_v3v3(f->no, f->no) <= FLT_EPSILON*10)
BM_Face_UpdateNormal(bm, f);
@@ -627,7 +627,7 @@
l = l->next;
} while (l != bm_firstfaceloop(f));
- mul_v2_fl(cent, 1.0/(float)f->len);
+ mul_v2_fl(cent, 1.0f/(float)f->len);
l = bm_firstfaceloop(f);
do {
Modified: branches/bmesh/blender/source/blender/bmesh/operators/bevel.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/bevel.c 2011-08-20 20:19:35 UTC (rev 39572)
+++ branches/bmesh/blender/source/blender/bmesh/operators/bevel.c 2011-08-20 20:19:58 UTC (rev 39573)
@@ -63,11 +63,11 @@
sub_v3_v3v3(vec2, v4, v3);
cross_v3_v3v3(no, vec1, vec2);
- if (dot_v3v3(no, no) == 0.0) {
+ if (dot_v3v3(no, no) == 0.0f) {
no[0] = no[1] = 0.0f; no[2] = -1.0f;
}
- inv = dot_v3v3(no, up) < 0.0;
+ inv = dot_v3v3(no, up) < 0.0f;
}
/*calculate normal*/
@@ -527,14 +527,14 @@
d2 = *(float*)CustomData_bmesh_get_n(&bm->edata, l2->e->head.data, CD_PROP_FLT, li);
ang = angle_v3v3v3(l->prev->v->co, l->v->co, BM_OtherEdgeVert(l2->e, l->v)->co);
- *d3 = (d1+d2)*0.5;
+ *d3 = (d1+d2)*0.5f;
d3 = CustomData_bmesh_get_n(&bm->edata, e2->head.data, CD_PROP_FLT, li);
d1 = *(float*)CustomData_bmesh_get_n(&bm->edata, l->next->e->head.data, CD_PROP_FLT, li);
d2 = *(float*)CustomData_bmesh_get_n(&bm->edata, l3->e->head.data, CD_PROP_FLT, li);
ang = angle_v3v3v3(BM_OtherEdgeVert(l->next->e, l->next->v)->co, l->next->v->co, BM_OtherEdgeVert(l3->e, l->next->v)->co);
- *d3 = (d1+d2)*0.5;
+ *d3 = (d1+d2)*0.5f;
}
if (!f) {
Modified: branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c 2011-08-20 20:19:35 UTC (rev 39572)
+++ branches/bmesh/blender/source/blender/bmesh/operators/bmesh_dupeops.c 2011-08-20 20:19:58 UTC (rev 39573)
@@ -567,7 +567,7 @@
BMO_Get_Vec(op, "dvec", dvec);
usedvec = !is_zero_v3(dvec);
steps = BMO_Get_Int(op, "steps");
- phi = BMO_Get_Float(op, "ang")*M_PI/(360.0*steps);
+ phi = BMO_Get_Float(op, "ang")*(float)M_PI/(360.0f*steps);
dupli = BMO_Get_Int(op, "dupli");
si = (float)sin(phi);
Modified: branches/bmesh/blender/source/blender/bmesh/operators/createops.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/createops.c 2011-08-20 20:19:35 UTC (rev 39572)
+++ branches/bmesh/blender/source/blender/bmesh/operators/createops.c 2011-08-20 20:19:58 UTC (rev 39573)
@@ -428,13 +428,13 @@
sub_v3_v3v3(vec2, vd2->sco, cent);
sub_v3_v3v3(vec3, vd3->sco, cent);
- size = (len_v3(vec1) + len_v3(vec3))*0.01;
+ size = (len_v3(vec1) + len_v3(vec3)) * 0.01f;
normalize_v3(vec1); normalize_v3(vec2); normalize_v3(vec3);
#ifdef STRAIGHT
#undef STRAIGHT
#endif
- #define STRAIGHT(vec11, vec22) (fabs(dot_v3v3((vec11), (vec22))) > 1.0-FLT_EPSILON*1000)
+ #define STRAIGHT(vec11, vec22) (fabsf(dot_v3v3((vec11), (vec22))) > 1.0f - ((float)FLT_EPSILON*1000.0f))
s1 = STRAIGHT(vec1, vec2); s2 = STRAIGHT(vec2, vec3); s3 = STRAIGHT(vec1, vec3);
Modified: branches/bmesh/blender/source/blender/bmesh/operators/join_triangles.c
===================================================================
--- branches/bmesh/blender/source/blender/bmesh/operators/join_triangles.c 2011-08-20 20:19:35 UTC (rev 39572)
+++ branches/bmesh/blender/source/blender/bmesh/operators/join_triangles.c 2011-08-20 20:19:58 UTC (rev 39573)
@@ -74,13 +74,11 @@
sub_v3_v3v3(edgeVec3, v3->co, v4->co);
sub_v3_v3v3(edgeVec4, v4->co, v1->co);
- diff = 0.0;
-
diff = (
- fabs(angle_v3v3(edgeVec1, edgeVec2) - M_PI/2) +
- fabs(angle_v3v3(edgeVec2, edgeVec3) - M_PI/2) +
- fabs(angle_v3v3(edgeVec3, edgeVec4) - M_PI/2) +
- fabs(angle_v3v3(edgeVec4, edgeVec1) - M_PI/2));
+ fabsf(angle_v3v3(edgeVec1, edgeVec2) - (float)M_PI_2) +
+ fabsf(angle_v3v3(edgeVec2, edgeVec3) - (float)M_PI_2) +
+ fabsf(angle_v3v3(edgeVec3, edgeVec4) - (float)M_PI_2) +
+ fabsf(angle_v3v3(edgeVec4, edgeVec1) - (float)M_PI_2));
if(!diff) return 0.0;
measure += diff;
@@ -102,7 +100,7 @@
return measure;
}
-#define T2QUV_LIMIT 0.005
+#define T2QUV_LIMIT 0.005f
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list