[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43940] branches/bmesh/blender/source/ blender/modifiers/intern/MOD_remesh.c: BMesh remesh modifier: create MPolys /MLoops directly rather than MFaces.

Nicholas Bishop nicholasbishop at gmail.com
Tue Feb 7 02:20:50 CET 2012


Revision: 43940
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43940
Author:   nicholasbishop
Date:     2012-02-07 01:20:49 +0000 (Tue, 07 Feb 2012)
Log Message:
-----------
BMesh remesh modifier: create MPolys/MLoops directly rather than MFaces.

This is also a bugfix, face normals were not showing correctly for the
remesh output.

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/modifiers/intern/MOD_remesh.c

Modified: branches/bmesh/blender/source/blender/modifiers/intern/MOD_remesh.c
===================================================================
--- branches/bmesh/blender/source/blender/modifiers/intern/MOD_remesh.c	2012-02-07 01:13:04 UTC (rev 43939)
+++ branches/bmesh/blender/source/blender/modifiers/intern/MOD_remesh.c	2012-02-07 01:20:49 UTC (rev 43940)
@@ -105,7 +105,7 @@
 							  "DualConOutput")))
 		return NULL;
 	
-	output->dm = CDDM_new(totvert, 0, totquad, 0, 0);
+	output->dm = CDDM_new(totvert, 0, 0, 4*totquad, totquad);
 	return output;
 }
 
@@ -124,18 +124,21 @@
 {
 	DualConOutput *output = output_v;
 	DerivedMesh *dm = output->dm;
-	MFace *mface;
+	MLoop *mloop;
+	MPoly *cur_poly;
+	int i;
 	
-	assert(output->curface < dm->getNumTessFaces(dm));
+	assert(output->curface < dm->getNumPolys(dm));
 
-	mface = &CDDM_get_tessfaces(dm)[output->curface];
-	mface->v1 = vert_indices[0];
-	mface->v2 = vert_indices[1];
-	mface->v3 = vert_indices[2];
-	mface->v4 = vert_indices[3];
+	mloop = CDDM_get_loops(dm);
+	cur_poly = CDDM_get_poly(dm, output->curface);
 	
-	if(test_index_face(mface, NULL, 0, 4))
-		output->curface++;
+	cur_poly->loopstart = output->curface * 4;
+	cur_poly->totloop = 4;
+	for(i = 0; i < 4; i++)
+		mloop[output->curface * 4 + i].v = vert_indices[i];
+	
+	output->curface++;
 }
 
 static DerivedMesh *applyModifier(ModifierData *md,
@@ -183,11 +186,8 @@
 					 rmd->scale,
 					 rmd->depth);
 	result = output->dm;
-	CDDM_lower_num_tessfaces(result, output->curface);
 	MEM_freeN(output);
 
-	CDDM_tessfaces_to_faces(result); /* BMESH_TODO - create polygons */
-
 	CDDM_calc_edges(result);
 	CDDM_calc_normals(result);
 	return result;




More information about the Bf-blender-cvs mailing list