modified fix for "Fix [#30351] Solidify Modifier High Quality Normals fails." from r44464.

rather then recalc polygon normals - solidify is simple enough to just flip the normals of the copied faces, the rim faces normals are already re-calculated so copy them.
This commit is contained in:
2012-02-26 18:12:01 +00:00
parent 6bc7c30b93
commit c956e5d2d9
3 changed files with 16 additions and 21 deletions

View File

@@ -183,7 +183,7 @@ static void createFacepa(ExplodeModifierData *emd,
BLI_kdtree_free(tree);
}
static int edgecut_get(EdgeHash *edgehash, int v1, int v2)
static int edgecut_get(EdgeHash *edgehash, unsigned int v1, unsigned int v2)
{
return GET_INT_FROM_POINTER(BLI_edgehash_lookup(edgehash, v1, v2));
}

View File

@@ -132,23 +132,6 @@ static void copyData(ModifierData *md, ModifierData *target)
tltmd->iter= sltmd->iter;
}
#if 0
static int findEd(MEdge *medge_new, int toted, int v1, int v2)
{
int i;
for (i = 0; i < toted; i++) {
if ( (medge_new[i].v1 == v1 && medge_new[i].v2 == v2) ||
(medge_new[i].v1 == v2 && medge_new[i].v2 == v1) )
{
return i;
}
}
return -1;
}
#endif
static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
DerivedMesh *derivedData,
int useRenderParams,

View File

@@ -235,6 +235,8 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
float (*vert_nors)[3]= NULL;
float (*face_nors_result)[3] = NULL;
const float ofs_orig= - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
const float ofs_new= smd->offset - (((-smd->offset_fac + 1.0f) * 0.5f) * smd->offset);
const float offset_fac_vg= smd->offset_fac_vg;
@@ -354,7 +356,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
DM_copy_poly_data(dm, result, 0, 0, numFaces);
DM_copy_poly_data(dm, result, 0, numFaces, numFaces);
/* if the original has it, get the result so we can update it */
face_nors_result = CustomData_get_layer(&result->polyData, CD_NORMAL);
/*flip normals*/
mp = mpoly + numFaces;
for (i=0; i<dm->numPolyData; i++, mp++) {
@@ -384,6 +389,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
ml2[j].e += numEdges;
ml2[j].v += numVerts;
}
if (face_nors_result) {
negate_v3_v3(face_nors_result[numFaces + i], face_nors_result[i]);
}
}
for(i=0, ed=medge+numEdges; i<numEdges; i++, ed++) {
@@ -667,6 +676,10 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
add_v3_v3(edge_vert_nos[ed->v1], nor);
add_v3_v3(edge_vert_nos[ed->v2], nor);
if (face_nors_result) {
copy_v3_v3(face_nors_result[(numFaces * 2) + i], nor);
}
#endif
}
@@ -702,8 +715,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
MEM_freeN(old_vert_arr);
/* must recalculate normals with vgroups since they can displace unevenly [#26888] */
/* Also needed in case of HQ normals [#30351] (don't really undestand why, though... --mont29). */
if (dvert || smd->flag & MOD_SOLIDIFY_NORMAL_CALC) {
if (dvert) {
CDDM_calc_normals(result);
}