|
From: Gordon K. <kin...@us...> - 2004-05-26 02:10:41
|
Update of /cvsroot/teem/teem/src/limn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13469 Modified Files: limn.h renderLimn.c transform.c Log Message: fixed STUPID design in how face depth sorting is implemented, which required a global variable Index: limn.h =================================================================== RCS file: /cvsroot/teem/teem/src/limn/limn.h,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** limn.h 13 May 2004 06:11:36 -0000 1.55 --- limn.h 26 May 2004 02:10:30 -0000 1.56 *************** *** 271,275 **** limnFace *face; int faceNum; airArray *faceArr; ! int *faceSort; /* indices into "face", sorted by depth */ limnPart **part; int partNum; /* double indirection, see above */ --- 271,275 ---- limnFace *face; int faceNum; airArray *faceArr; ! limnFace **faceSort; /* pointers into "face", sorted by depth */ limnPart **part; int partNum; /* double indirection, see above */ Index: renderLimn.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/renderLimn.c,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** renderLimn.c 13 May 2004 06:11:36 -0000 1.25 --- renderLimn.c 26 May 2004 02:10:31 -0000 1.26 *************** *** 352,356 **** (contours, front crease, front non-crease) */ for (faceIdx=0; faceIdx<obj->faceNum; faceIdx++) { ! face = obj->face + obj->faceSort[faceIdx]; part = obj->part[face->partIdx]; if (!face->visible) { --- 352,356 ---- (contours, front crease, front non-crease) */ for (faceIdx=0; faceIdx<obj->faceNum; faceIdx++) { ! face = obj->faceSort[faceIdx]; part = obj->part[face->partIdx]; if (!face->visible) { Index: transform.c =================================================================== RCS file: /cvsroot/teem/teem/src/limn/transform.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** transform.c 13 May 2004 06:11:36 -0000 1.23 --- transform.c 26 May 2004 02:10:31 -0000 1.24 *************** *** 288,301 **** } - limnFace *_limnFaceHack; - int _limnFaceDepthCompare(const void *_a, const void *_b) { ! int *a; ! int *b; ! a = (int *)_a; ! b = (int *)_b; ! return -AIR_COMPARE(_limnFaceHack[*a].depth, _limnFaceHack[*b].depth); } --- 288,299 ---- } int _limnFaceDepthCompare(const void *_a, const void *_b) { ! limnFace **a; ! limnFace **b; ! a = (limnFace **)_a; ! b = (limnFace **)_b; ! return -AIR_COMPARE((*a)->depth, (*b)->depth); } *************** *** 307,311 **** int faceIdx, vii; ! obj->faceSort = (int*)calloc(obj->faceNum, sizeof(int)); for (faceIdx=0; faceIdx<obj->faceNum; faceIdx++) { face = obj->face + faceIdx; --- 305,309 ---- int faceIdx, vii; ! obj->faceSort = (limnFace **)calloc(obj->faceNum, sizeof(limnFace *)); for (faceIdx=0; faceIdx<obj->faceNum; faceIdx++) { face = obj->face + faceIdx; *************** *** 317,325 **** } face->depth /= face->sideNum; ! obj->faceSort[faceIdx] = faceIdx; } ! _limnFaceHack = obj->face; ! qsort(obj->faceSort, obj->faceNum, sizeof(int), _limnFaceDepthCompare); return 0; --- 315,323 ---- } face->depth /= face->sideNum; ! obj->faceSort[faceIdx] = face; } ! qsort(obj->faceSort, obj->faceNum, ! sizeof(limnFace *), _limnFaceDepthCompare); return 0; |