Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-02-07 05:20:49 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-02-07 05:20:49 +0400
commit6ee4451a9ef934196266833728800617f7ae5429 (patch)
tree254bf437f3b228de62936fd457cd6a6959e63af3 /source/blender/modifiers/intern/MOD_remesh.c
parent5f6395d69eae73f1e440b4dd84a385601911cfb1 (diff)
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.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_remesh.c')
-rw-r--r--source/blender/modifiers/intern/MOD_remesh.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index b3e98143971..ec893a3bf44 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -105,7 +105,7 @@ static void *dualcon_alloc_output(int totvert, int totquad)
"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 @@ static void dualcon_add_quad(void *output_v, const int vert_indices[4])
{
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 @@ static DerivedMesh *applyModifier(ModifierData *md,
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;