From b41a4764011e875c15e853f3a464bd9d3db3248d Mon Sep 17 00:00:00 2001 From: Chris Want Date: Tue, 3 Jan 2006 17:22:42 +0000 Subject: As positively recieved on the mailing list and irc (and blessed by guitargeek), this commit enhances the support for temporary storage for the structs EditVert, EditEdge, and EditFace. The field "EditVert *vn" has been removed and replaced by a union called "tmp" that can hold: v, an EditVert pointer; e, an EditEdge pointer; f, an EditFace pointer; fp, a float pointer; p, a void pointer; l, a long; Please see the mailing list post here for more information about this: http://projects.blender.org/pipermail/bf-committers/2005-December/012877.html --- source/blender/blenlib/BLI_editVert.h | 36 +++++++++++++++++++++++++++++--- source/blender/blenlib/intern/scanfill.c | 24 +++++++++++---------- 2 files changed, 46 insertions(+), 14 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/BLI_editVert.h b/source/blender/blenlib/BLI_editVert.h index a11e1ebfeff..315498bab4c 100644 --- a/source/blender/blenlib/BLI_editVert.h +++ b/source/blender/blenlib/BLI_editVert.h @@ -43,7 +43,18 @@ struct DerivedMesh; /* note; changing this also might affect the undo copy in editmesh.c */ typedef struct EditVert { - struct EditVert *next, *prev, *vn; + struct EditVert *next, *prev; + union { + /* some lean storage for temporary usage + * in editmesh routines + */ + struct EditVert *v; + struct EditEdge *e; + struct EditFace *f; + float *fp; + void *p; + long l; + } tmp; float no[3]; float co[3]; short xs, ys; @@ -66,8 +77,17 @@ typedef struct HashEdge { typedef struct EditEdge { struct EditEdge *next, *prev; - /* Note: vn is for general purpose temporary storage */ - struct EditVert *v1, *v2, *vn; + struct EditVert *v1, *v2; + union { + /* some lean storage for temporary usage + * in editmesh routines + */ + struct EditVert *v; + struct EditEdge *e; + struct EditFace *f; + void *p; + long l; + } tmp; short f1, f2; /* short, f1 is (ab)used in subdiv */ unsigned char f, h, dir, seam; float crease; @@ -82,6 +102,16 @@ typedef struct EditFace struct EditFace *next, *prev; struct EditVert *v1, *v2, *v3, *v4; struct EditEdge *e1, *e2, *e3, *e4; + union { + /* some lean storage for temporary usage + * in editmesh routines + */ + struct EditVert *v; + struct EditEdge *e; + struct EditFace *f; + void *p; + long l; + } tmp; float n[3], cent[3]; struct TFace tf; /* a copy of original tface. */ unsigned char mat_nr, flag; diff --git a/source/blender/blenlib/intern/scanfill.c b/source/blender/blenlib/intern/scanfill.c index 90ada479ca5..1e11bec25ff 100644 --- a/source/blender/blenlib/intern/scanfill.c +++ b/source/blender/blenlib/intern/scanfill.c @@ -581,18 +581,18 @@ static void scanfill(PolyFill *pf, int mat_nr) if(eed->v1->co[coy]==eed->v2->co[coy]) { if(eed->v1->f==255 && eed->v2->f!=255) { eed->v2->f= 255; - eed->v2->vn= eed->v1->vn; + eed->v2->tmp.v= eed->v1->tmp.v; } else if(eed->v2->f==255 && eed->v1->f!=255) { eed->v1->f= 255; - eed->v1->vn= eed->v2->vn; + eed->v1->tmp.v= eed->v2->tmp.v; } else if(eed->v2->f==255 && eed->v1->f==255) { - eed->v1->vn= eed->v2->vn; + eed->v1->tmp.v= eed->v2->tmp.v; } else { eed->v2->f= 255; - eed->v2->vn= eed->v1; + eed->v2->tmp.v = eed->v1; } } } @@ -627,11 +627,13 @@ static void scanfill(PolyFill *pf, int mat_nr) BLI_remlink(&filledgebase,eed); if(eed->v1->f==255) { v1= eed->v1; - while(eed->v1->f==255 && eed->v1->vn!=v1) eed->v1= eed->v1->vn; + while((eed->v1->f == 255) && (eed->v1->tmp.v != v1)) + eed->v1 = eed->v1->tmp.v; } if(eed->v2->f==255) { v2= eed->v2; - while(eed->v2->f==255 && eed->v2->vn!=v2) eed->v2= eed->v2->vn; + while((eed->v2->f == 255) && (eed->v2->tmp.v != v2)) + eed->v2 = eed->v2->tmp.v; } if(eed->v1!=eed->v2) addedgetoscanlist(eed,verts); @@ -808,7 +810,7 @@ int BLI_edgefill(int mode, int mat_nr) { /* - fill works with its own lists, so create that first (no faces!) - - for vertices, put in ->vn the old pointer + - for vertices, put in ->tmp.v the old pointer - struct elements xs en ys are not used here: don't hide stuff in it - edge flag ->f becomes 2 when it's a new edge - mode: & 1 is check for crossings, then create edges (TO DO ) @@ -980,10 +982,10 @@ int BLI_edgefill(int mode, int mat_nr) /* CURRENT STATUS: - - eve->f :1= availalble in edges - - eve->xs :polynumber - - eve->h :amount of edges connected to vertex - - eve->vn :store! original vertex number + - eve->f :1= availalble in edges + - eve->xs :polynumber + - eve->h :amount of edges connected to vertex + - eve->tmp.v :store! original vertex number - eed->f : - eed->f1 :poly number -- cgit v1.2.3