diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-12-28 08:43:29 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-12-28 08:43:29 +0400 |
commit | 4bc4c018d1975708ce580783152b66676257d67e (patch) | |
tree | 1cca0c1cc078adf6160a3a53a29839056e0aec64 | |
parent | 74b1a6465fa40e675cbf59937426cfdc037905e2 (diff) |
set mloop edge and vertex as unsigned ints since face/edge reference verts as unsigned ints too
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_meshdata_types.h | 12 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_solidify.c | 6 |
4 files changed, 17 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index f765be4bf17..48707b0f2a0 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -1980,9 +1980,10 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis MPoly *mpoly = cddm->mpoly; int numCol = CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPCOL); int numTex = CustomData_number_of_layers(&em->bm->pdata, CD_MTEXPOLY); - int i, j, *index, *polyindex, add_orig; + int *index, *polyindex, add_orig; int has_crease, has_edge_bweight, has_vert_bweight; int flag; + unsigned int i, j; has_edge_bweight = CustomData_has_layer(&em->bm->edata, CD_BWEIGHT); has_vert_bweight = CustomData_has_layer(&em->bm->vdata, CD_BWEIGHT); @@ -2324,7 +2325,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, int *vtargetmap) ml = cddm->mloop; c = 0; for (i=0; i<totloop; i++, ml++) { - if (ml->v == -1) + if (ml->v == ME_LOOP_INVALID_INDEX) continue; if (vtargetmap[ml->v] != -1) @@ -2371,7 +2372,7 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, int *vtargetmap) c = 0; for (j=0; j<mp->totloop; j++, ml++) { - if (ml->v == -1) + if (ml->v == ME_LOOP_INVALID_INDEX) continue; me = cddm->medge + ml->e; diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 4b2195cda9f..71158729eb3 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -304,8 +304,8 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, /* create faces */ for (i=0; i<totface; i++) { - MPoly *mp = &((MPoly*) mpoly)[i]; - MLoop *ml= mloop + mp->loopstart; + MPoly *mp = &mpoly[i]; + MLoop *ml= &mloop[mp->loopstart]; int nverts= mp->totloop; CCGFace *f; diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index d1b530dae73..1f2612ed27a 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -77,8 +77,9 @@ typedef struct MCol { /*new face structure, replaces MFace, which is now only used for storing tesselations.*/ typedef struct MPoly { - /*offset into loop array and number of loops in the face*/ - int loopstart, totloop; + /* offset into loop array and number of loops in the face */ + int loopstart; + int totloop; /* keep signed since we need to subtract when getting the previous loop */ short mat_nr; char flag, pad; } MPoly; @@ -86,8 +87,8 @@ typedef struct MPoly { /*the e here is because we want to move away from relying on edge hashes.*/ typedef struct MLoop { - int v; /*vertex index*/ - int e; /*edge index*/ + unsigned int v; /*vertex index*/ + unsigned int e; /*edge index*/ } MLoop; typedef struct MTexPoly{ @@ -243,6 +244,9 @@ typedef struct MRecast{ #define ME_ESEL 1 #define ME_FSEL 2 +/* mloop->v */ +#define ME_LOOP_INVALID_INDEX ((unsigned int) -1) + /* mtface->flag */ #define TF_SELECT 1 /* use MFace hide flag (after 2.43), should be able to reuse after 2.44 */ #define TF_ACTIVE 2 /* deprecated! */ diff --git a/source/blender/modifiers/intern/MOD_solidify.c b/source/blender/modifiers/intern/MOD_solidify.c index 4ae1867b243..6f6e13312d8 100644 --- a/source/blender/modifiers/intern/MOD_solidify.c +++ b/source/blender/modifiers/intern/MOD_solidify.c @@ -451,13 +451,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, } for (i=0, mp=mpoly; i<numFaces; i++, mp++) { - mesh_calc_poly_normal(mp, mloop+mp->loopstart, mvert, face_nors[i]); + mesh_calc_poly_normal(mp, &mloop[mp->loopstart], mvert, face_nors[i]); /* just added, calc the normal */ BLI_array_empty(face_angles); for (j=0, ml=mloop+mp->loopstart; j<mp->totloop; j++, ml++) { - MLoop *ml2 = mloop + mp->loopstart + (j+1)%mp->totloop; //next - MLoop *ml3 = mloop + mp->loopstart + (j+mp->totloop-1)%mp->totloop; //previous + MLoop *ml2 = &mloop[mp->loopstart + (j + 1) % mp->totloop]; //next + MLoop *ml3 = &mloop[mp->loopstart + (j + mp->totloop - 1) % mp->totloop]; //previous float e1[3], e2[3], angle; sub_v3_v3v3(e1, mvert[ml2->v].co, mvert[ml->v].co); |