[Bf-blender-cvs] [2b3c3bd] bmesh-boolean-experiment: Turns out face normals are needed for edge-net split
Campbell Barton
noreply at git.blender.org
Thu Nov 26 08:30:48 CET 2015
Commit: 2b3c3bd27aeb6317079a1e04d41275d51a76774a
Author: Campbell Barton
Date: Thu Nov 26 18:20:06 2015 +1100
Branches: bmesh-boolean-experiment
https://developer.blender.org/rB2b3c3bd27aeb6317079a1e04d41275d51a76774a
Turns out face normals are needed for edge-net split
===================================================================
M source/blender/modifiers/intern/MOD_boolean.c
===================================================================
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 4bf68f5..fd9b327 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -210,18 +210,37 @@ static DerivedMesh *applyModifier(
* so we can use the original normals before the vertex are moved */
{
BMIter iter;
- BMVert *eve;
- int i = 0, i_end = dm_other->getNumVerts(dm_other);
+ int i;
+ const int i_verts_end = dm_other->getNumVerts(dm_other);
+ const int i_faces_end = dm_other->getNumPolys(dm_other);
- float mat[4][4];
+ float imat[4][4];
float omat[4][4];
- invert_m4_m4(mat, ob->obmat);
- mul_m4_m4m4(omat, mat, bmd->object->obmat);
+
+ invert_m4_m4(imat, ob->obmat);
+ mul_m4_m4m4(omat, imat, bmd->object->obmat);
+ BMVert *eve;
+ i = 0;
BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
mul_m4_v3(omat, eve->co);
- if (++i == i_end) {
+ if (++i == i_verts_end) {
+ break;
+ }
+ }
+
+ /* we need face normals because of 'BM_face_split_edgenet'
+ * we could calculate on the fly too (before calling split). */
+ float nmat[4][4];
+ invert_m4_m4(nmat, omat);
+
+ BMFace *efa;
+ i = 0;
+ BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+ mul_transposed_mat3_m4_v3(nmat, efa->no);
+ normalize_v3(efa->no);
+ if (++i == i_faces_end) {
break;
}
}
More information about the Bf-blender-cvs
mailing list