fix own error with subdivision (broke icosphere), also noticed icosphere vanished at subd-5 which didnt happen before bmesh.

This commit is contained in:
Campbell Barton
2012-04-23 23:01:03 +00:00
parent 6859537679
commit 03f451f2f1
2 changed files with 9 additions and 7 deletions

View File

@@ -484,12 +484,14 @@ static int bm_to_mesh_shape_layer_index_from_kb(BMesh *bm, KeyBlock *currkey)
BLI_INLINE void bmesh_quick_edgedraw_flag(MEdge *med, BMEdge *e)
{
/* this is a cheap way to set the edge draw, its not precise and will
* pick the first 2 faces an edge uses */
* pick the first 2 faces an edge uses.
* The dot comparison is a little arbitrary, but set so that a 5 subd
* IcoSphere won't vanish but subd 6 will (as with pre-bmesh blender) */
if ( /* (med->flag & ME_EDGEDRAW) && */ /* assume to be true */
(e->l && (e->l != e->l->radial_next)) &&
(dot_v3v3(e->l->f->no, e->l->radial_next->f->no) > 0.998f))
(dot_v3v3(e->l->f->no, e->l->radial_next->f->no) > 0.9995f))
{
med->flag &= ~ME_EDGEDRAW;
}

View File

@@ -109,7 +109,11 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
copy_v3_v3(co, v->co);
copy_v3_v3(prev_co, co);
if (params->use_smooth) {
if (UNLIKELY(params->use_sphere)) { /* subdivide sphere */
normalize_v3(co);
mul_v3_fl(co, params->smooth);
}
else if (params->use_smooth) {
/* we calculate an offset vector vec1[], to be added to *co */
float len, nor[3], nor1[3], nor2[3], smooth = params->smooth;
@@ -134,10 +138,6 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const SubDPar
add_v3_v3(co, tvec);
}
else if (params->use_sphere) { /* subdivide sphere */
normalize_v3(co);
mul_v3_fl(co, params->smooth);
}
if (params->use_fractal) {
float len = len_v3v3(vsta->co, vend->co);