diff options
author | Joseph Eagar <joeedh@gmail.com> | 2009-08-15 21:31:28 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2009-08-15 21:31:28 +0400 |
commit | 348dc14d5b3511d2d999e60c47308a2fa5fb5033 (patch) | |
tree | eaa4b969a3cd7721ece1a9962a1b0905f9c950ab /source/blender | |
parent | 5c7982de5e3a18ab54c7e265e29d9b9e219a0c17 (diff) |
made the crash handler disabled by a command line flag, insted of being #ifdef'd out on release builds. also did little bit of work on subsurf. and face select can now deselect again, and fixed some other bugs with it (and subsurf).
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 18 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/CCGSubSurf.c | 486 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/CCGSubSurf.h | 209 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 35 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/editderivedbmesh.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifier.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 1461 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_select.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/bmesh_tools.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 6 |
12 files changed, 1170 insertions, 1077 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 6288e5d71b0..ba831cdf015 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -124,6 +124,19 @@ typedef struct DMLoopIter { loop refers to per-face-vertex data.*/ void *(*getLoopCDData)(void *self, int type, int layer); void *(*getVertCDData)(void *self, int type, int layer); + +/* derivedmesh 2.0 interface ideas (will likely never be implemented ;): + void (*interpLoopData)(void *self, void **src_blocks, + float *weights, float *sub_weights, int count); + + //a generic handle for a loop + intptr_t lhandle; + + inside DerivedMesh itself: + // + //void (*interpLoopData)(DerivedMesh *dm, DMLoopIter *destloop, + // intptr_t *loop_handles, int totloop); +*/ } DMLoopIter; typedef struct DMFaceIter { @@ -227,7 +240,7 @@ struct DerivedMesh { void (*copyFromVertCData)(DerivedMesh *dm, int source, CustomData *dst, int dest); void (*copyFromEdgeCData)(DerivedMesh *dm, int source, CustomData *dst, int dest); void (*copyFromFaceCData)(DerivedMesh *dm, int source, CustomData *dst, int dest); - + /* Iterate over each mapped vertex in the derived mesh, calling the * given function with the original vert and the mapped vert's new * coordinate and normal. For historical reasons the normal can be @@ -431,6 +444,8 @@ void DM_add_vert_layer(struct DerivedMesh *dm, int type, int alloctype, void *layer); void DM_add_edge_layer(struct DerivedMesh *dm, int type, int alloctype, void *layer); +void DM_add_tessface_layer(struct DerivedMesh *dm, int type, int alloctype, + void *layer); void DM_add_face_layer(struct DerivedMesh *dm, int type, int alloctype, void *layer); @@ -450,6 +465,7 @@ void *DM_get_face_data(struct DerivedMesh *dm, int index, int type); */ void *DM_get_vert_data_layer(struct DerivedMesh *dm, int type); void *DM_get_edge_data_layer(struct DerivedMesh *dm, int type); +void *DM_get_tessface_data_layer(struct DerivedMesh *dm, int type); void *DM_get_face_data_layer(struct DerivedMesh *dm, int type); /* custom data setting functions diff --git a/source/blender/blenkernel/intern/CCGSubSurf.c b/source/blender/blenkernel/intern/CCGSubSurf.c index c2fc626b8e1..a3569298fde 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.c +++ b/source/blender/blenkernel/intern/CCGSubSurf.c @@ -31,7 +31,7 @@ typedef struct _EHash { int numEntries, curSize, curSizeIdx; CCGAllocatorIFC allocatorIFC; - CCGAllocatorHDL allocator; + CCAllocHDL allocator; } EHash; #define EHASH_alloc(eh, nb) ((eh)->allocatorIFC.alloc((eh)->allocator, nb)) @@ -39,7 +39,7 @@ typedef struct _EHash { #define EHASH_hash(eh, item) (((uintptr_t) (item))%((unsigned int) (eh)->curSize)) -static EHash *_ehash_new(int estimatedNumEntries, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator) { +static EHash *_ehash_new(int estimatedNumEntries, CCGAllocatorIFC *allocatorIFC, CCAllocHDL allocator) { EHash *eh = allocatorIFC->alloc(allocator, sizeof(*eh)); eh->allocatorIFC = *allocatorIFC; eh->allocator = allocator; @@ -175,13 +175,13 @@ static int _ehashIterator_isStopped(EHashIterator *ehi) { /***/ -static void *_stdAllocator_alloc(CCGAllocatorHDL a, int numBytes) { +static void *_stdAllocator_alloc(CCAllocHDL a, int numBytes) { return malloc(numBytes); } -static void *_stdAllocator_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSize) { +static void *_stdAllocator_realloc(CCAllocHDL a, void *ptr, int newSize, int oldSize) { return realloc(ptr, newSize); } -static void _stdAllocator_free(CCGAllocatorHDL a, void *ptr) { +static void _stdAllocator_free(CCAllocHDL a, void *ptr) { free(ptr); } @@ -218,7 +218,7 @@ static int VertDataEqual(float *a, float *b) { #define NormAdd(av, bv) { float *_a = (float*) av, *_b = (float*) bv; _a[0]+=_b[0]; _a[1]+=_b[1]; _a[2]+=_b[2]; } -static int _edge_isBoundary(CCGEdge *e); +static int _edge_isBoundary(CCEdge *e); /***/ @@ -229,53 +229,53 @@ enum { } VertFlags; enum { Edge_eEffected= (1<<0), -} CCGEdgeFlags; +} CCEdgeFlags; enum { Face_eEffected= (1<<0), } FaceFlags; -struct _CCGVert { - CCGVert *next; /* EHData.next */ - CCGVertHDL vHDL; /* EHData.key */ +struct _CCVert { + CCVert *next; /* EHData.next */ + CCVertHDL vHDL; /* EHData.key */ short numEdges, numFaces, flags, pad; - CCGEdge **edges; - CCGFace **faces; + CCEdge **edges; + CCFace **faces; // byte *levelData; // byte *userData; }; #define VERT_getLevelData(v) ((byte*) &(v)[1]) -struct _CCGEdge { - CCGEdge *next; /* EHData.next */ - CCGEdgeHDL eHDL; /* EHData.key */ +struct _CCEdge { + CCEdge *next; /* EHData.next */ + CCEdgeHDL eHDL; /* EHData.key */ short numFaces, flags; float crease; - CCGVert *v0,*v1; - CCGFace **faces; + CCVert *v0,*v1; + CCFace **faces; // byte *levelData; // byte *userData; }; #define EDGE_getLevelData(e) ((byte*) &(e)[1]) -struct _CCGFace { - CCGFace *next; /* EHData.next */ - CCGFaceHDL fHDL; /* EHData.key */ +struct _CCFace { + CCFace *next; /* EHData.next */ + CCFaceHDL fHDL; /* EHData.key */ short numVerts, flags, pad1, pad2; -// CCGVert **verts; -// CCGEdge **edges; +// CCVert **verts; +// CCEdge **edges; // byte *centerData; // byte **gridData; // byte *userData; }; -#define FACE_getVerts(f) ((CCGVert**) &(f)[1]) -#define FACE_getEdges(f) ((CCGEdge**) &(FACE_getVerts(f)[(f)->numVerts])) +#define FACE_getVerts(f) ((CCVert**) &(f)[1]) +#define FACE_getEdges(f) ((CCEdge**) &(FACE_getVerts(f)[(f)->numVerts])) #define FACE_getCenterData(f) ((byte*) &(FACE_getEdges(f)[(f)->numVerts])) typedef enum { @@ -286,15 +286,15 @@ typedef enum { eSyncState_Partial, } SyncState; -struct _CCGSubSurf { - EHash *vMap; /* map of CCGVertHDL -> Vert */ - EHash *eMap; /* map of CCGEdgeHDL -> Edge */ - EHash *fMap; /* map of CCGFaceHDL -> Face */ +struct _CSubSurf { + EHash *vMap; /* map of CCVertHDL -> Vert */ + EHash *eMap; /* map of CCEdgeHDL -> Edge */ + EHash *fMap; /* map of CCFaceHDL -> Face */ CCGMeshIFC meshIFC; CCGAllocatorIFC allocatorIFC; - CCGAllocatorHDL allocator; + CCAllocHDL allocator; int subdivLevels; int numGrids; @@ -320,8 +320,8 @@ struct _CCGSubSurf { EHash *oldVMap, *oldEMap, *oldFMap; int lenTempArrays; - CCGVert **tempVerts; - CCGEdge **tempEdges; + CCVert **tempVerts; + CCEdge **tempEdges; }; #define CCGSUBSURF_alloc(ss, nb) ((ss)->allocatorIFC.alloc((ss)->allocator, nb)) @@ -330,8 +330,8 @@ struct _CCGSubSurf { /***/ -static CCGVert *_vert_new(CCGVertHDL vHDL, CCGSubSurf *ss) { - CCGVert *v = CCGSUBSURF_alloc(ss, sizeof(CCGVert) + ss->meshIFC.vertDataSize * (ss->subdivLevels+1) + ss->meshIFC.vertUserSize); +static CCVert *_vert_new(CCVertHDL vHDL, CSubSurf *ss) { + CCVert *v = CCGSUBSURF_alloc(ss, sizeof(CCVert) + ss->meshIFC.vertDataSize * (ss->subdivLevels+1) + ss->meshIFC.vertUserSize); byte *userData; v->vHDL = vHDL; @@ -340,13 +340,13 @@ static CCGVert *_vert_new(CCGVertHDL vHDL, CCGSubSurf *ss) { v->numEdges = v->numFaces = 0; v->flags = 0; - userData = ccgSubSurf_getVertUserData(ss, v); + userData = CCS_getVertUserData(ss, v); memset(userData, 0, ss->meshIFC.vertUserSize); if (ss->useAgeCounts) *((int*) &userData[ss->vertUserAgeOffset]) = ss->currentAge; return v; } -static void _vert_remEdge(CCGVert *v, CCGEdge *e) { +static void _vert_remEdge(CCVert *v, CCEdge *e) { int i; for (i=0; i<v->numEdges; i++) { if (v->edges[i]==e) { @@ -355,7 +355,7 @@ static void _vert_remEdge(CCGVert *v, CCGEdge *e) { } } } -static void _vert_remFace(CCGVert *v, CCGFace *f) { +static void _vert_remFace(CCVert *v, CCFace *f) { int i; for (i=0; i<v->numFaces; i++) { if (v->faces[i]==f) { @@ -364,25 +364,25 @@ static void _vert_remFace(CCGVert *v, CCGFace *f) { } } } -static void _vert_addEdge(CCGVert *v, CCGEdge *e, CCGSubSurf *ss) { +static void _vert_addEdge(CCVert *v, CCEdge *e, CSubSurf *ss) { v->edges = CCGSUBSURF_realloc(ss, v->edges, (v->numEdges+1)*sizeof(*v->edges), v->numEdges*sizeof(*v->edges)); v->edges[v->numEdges++] = e; } -static void _vert_addFace(CCGVert *v, CCGFace *f, CCGSubSurf *ss) { +static void _vert_addFace(CCVert *v, CCFace *f, CSubSurf *ss) { v->faces = CCGSUBSURF_realloc(ss, v->faces, (v->numFaces+1)*sizeof(*v->faces), v->numFaces*sizeof(*v->faces)); v->faces[v->numFaces++] = f; } -static CCGEdge *_vert_findEdgeTo(CCGVert *v, CCGVert *vQ) { +static CCEdge *_vert_findEdgeTo(CCVert *v, CCVert *vQ) { int i; for (i=0; i<v->numEdges; i++) { - CCGEdge *e = v->edges[v->numEdges-1-i]; // XXX, note reverse + CCEdge *e = v->edges[v->numEdges-1-i]; // XXX, note reverse if ( (e->v0==v && e->v1==vQ) || (e->v1==v && e->v0==vQ)) return e; } return 0; } -static int _vert_isBoundary(CCGVert *v) { +static int _vert_isBoundary(CCVert *v) { int i; for (i=0; i<v->numEdges; i++) if (_edge_isBoundary(v->edges[i])) @@ -390,27 +390,27 @@ static int _vert_isBoundary(CCGVert *v) { return 0; } -static void *_vert_getCo(CCGVert *v, int lvl, int dataSize) { +static void *_vert_getCo(CCVert *v, int lvl, int dataSize) { return &VERT_getLevelData(v)[lvl*dataSize]; } -static float *_vert_getNo(CCGVert *v, int lvl, int dataSize, int normalDataOffset) { +static float *_vert_getNo(CCVert *v, int lvl, int dataSize, int normalDataOffset) { return (float*) &VERT_getLevelData(v)[lvl*dataSize + normalDataOffset]; } -static void _vert_free(CCGVert *v, CCGSubSurf *ss) { +static void _vert_free(CCVert *v, CSubSurf *ss) { CCGSUBSURF_free(ss, v->edges); CCGSUBSURF_free(ss, v->faces); CCGSUBSURF_free(ss, v); } -static int VERT_seam(CCGVert *v) { +static int VERT_seam(CCVert *v) { return ((v->flags & Vert_eSeam) != 0); } /***/ -static CCGEdge *_edge_new(CCGEdgeHDL eHDL, CCGVert *v0, CCGVert *v1, float crease, CCGSubSurf *ss) { - CCGEdge *e = CCGSUBSURF_alloc(ss, sizeof(CCGEdge) + ss->meshIFC.vertDataSize *((ss->subdivLevels+1) + (1<<(ss->subdivLevels+1))-1) + ss->meshIFC.edgeUserSize); +static CCEdge *_edge_new(CCEdgeHDL eHDL, CCVert *v0, CCVert *v1, float crease, CSubSurf *ss) { + CCEdge *e = CCGSUBSURF_alloc(ss, sizeof(CCEdge) + ss->meshIFC.vertDataSize *((ss->subdivLevels+1) + (1<<(ss->subdivLevels+1))-1) + ss->meshIFC.edgeUserSize); byte *userData; e->eHDL = eHDL; @@ -423,13 +423,13 @@ static CCGEdge *_edge_new(CCGEdgeHDL eHDL, CCGVert *v0, CCGVert *v1, float creas _vert_addEdge(v0, e, ss); _vert_addEdge(v1, e, ss); - userData = ccgSubSurf_getEdgeUserData(ss, e); + userData = CCS_getEdgeUserData(ss, e); memset(userData, 0, ss->meshIFC.edgeUserSize); if (ss->useAgeCounts) *((int*) &userData[ss->edgeUserAgeOffset]) = ss->currentAge; return e; } -static void _edge_remFace(CCGEdge *e, CCGFace *f) { +static void _edge_remFace(CCEdge *e, CCFace *f) { int i; for (i=0; i<e->numFaces; i++) { if (e->faces[i]==f) { @@ -438,15 +438,15 @@ static void _edge_remFace(CCGEdge *e, CCGFace *f) { } } } -static void _edge_addFace(CCGEdge *e, CCGFace *f, CCGSubSurf *ss) { +static void _edge_addFace(CCEdge *e, CCFace *f, CSubSurf *ss) { e->faces = CCGSUBSURF_realloc(ss, e->faces, (e->numFaces+1)*sizeof(*e->faces), e->numFaces*sizeof(*e->faces)); e->faces[e->numFaces++] = f; } -static int _edge_isBoundary(CCGEdge *e) { +static int _edge_isBoundary(CCEdge *e) { return e->numFaces<2; } -static CCGVert *_edge_getOtherVert(CCGEdge *e, CCGVert *vQ) { +static CCVert *_edge_getOtherVert(CCEdge *e, CCVert *vQ) { if (vQ==e->v0) { return e->v1; } else { @@ -454,17 +454,17 @@ static CCGVert *_edge_getOtherVert(CCGEdge *e, CCGVert *vQ) { } } -static void *_edge_getCo(CCGEdge *e, int lvl, int x, int dataSize) { +static void *_edge_getCo(CCEdge *e, int lvl, int x, int dataSize) { int levelBase = lvl + (1<<lvl) - 1; return &EDGE_getLevelData(e)[dataSize*(levelBase + x)]; } #if 0 -static float *_edge_getNo(CCGEdge *e, int lvl, int x, int dataSize, int normalDataOffset) { +static float *_edge_getNo(CCEdge *e, int lvl, int x, int dataSize, int normalDataOffset) { int levelBase = lvl + (1<<lvl) - 1; return (float*) &EDGE_getLevelData(e)[dataSize*(levelBase + x) + normalDataOffset]; } #endif -static void *_edge_getCoVert(CCGEdge *e, CCGVert *v, int lvl, int x, int dataSize) { +static void *_edge_getCoVert(CCEdge *e, CCVert *v, int lvl, int x, int dataSize) { int levelBase = lvl + (1<<lvl) - 1; if (v==e->v0) { return &EDGE_getLevelData(e)[dataSize*(levelBase + x)]; @@ -473,11 +473,11 @@ static void *_edge_getCoVert(CCGEdge *e, CCGVert *v, int lvl, int x, int dataSiz } } -static void _edge_free(CCGEdge *e, CCGSubSurf *ss) { +static void _edge_free(CCEdge *e, CSubSurf *ss) { CCGSUBSURF_free(ss, e->faces); CCGSUBSURF_free(ss, e); } -static void _edge_unlinkMarkAndFree(CCGEdge *e, CCGSubSurf *ss) { +static void _edge_unlinkMarkAndFree(CCEdge *e, CSubSurf *ss) { _vert_remEdge(e->v0, e); _vert_remEdge(e->v1, e); e->v0->flags |= Vert_eEffected; @@ -485,7 +485,7 @@ static void _edge_unlinkMarkAndFree(CCGEdge *e, CCGSubSurf *ss) { _edge_free(e, ss); } -static float EDGE_getSharpness(CCGEdge *e, int lvl) { +static float EDGE_getSharpness(CCEdge *e, int lvl) { if (!lvl) return e->crease; else if (!e->crease) @@ -496,9 +496,9 @@ static float EDGE_getSharpness(CCGEdge *e, int lvl) { return e->crease - lvl; } -static CCGFace *_face_new(CCGFaceHDL fHDL, CCGVert **verts, CCGEdge **edges, int numVerts, CCGSubSurf *ss) { +static CCFace *_face_new(CCFaceHDL fHDL, CCVert **verts, CCEdge **edges, int numVerts, CSubSurf *ss) { int maxGridSize = 1 + (1<<(ss->subdivLevels-1)); - CCGFace *f = CCGSUBSURF_alloc(ss, sizeof(CCGFace) + sizeof(CCGVert*)*numVerts + sizeof(CCGEdge*)*numVerts + ss->meshIFC.vertDataSize *(1 + numVerts*maxGridSize + numVerts*maxGridSize*maxGridSize) + ss->meshIFC.faceUserSize); + CCFace *f = CCGSUBSURF_alloc(ss, sizeof(CCFace) + sizeof(CCVert*)*numVerts + sizeof(CCEdge*)*numVerts + ss->meshIFC.vertDataSize *(1 + numVerts*maxGridSize + numVerts*maxGridSize*maxGridSize) + ss->meshIFC.faceUserSize); byte *userData; int i; @@ -513,39 +513,39 @@ static CCGFace *_face_new(CCGFaceHDL fHDL, CCGVert **verts, CCGEdge **edges, int _edge_addFace(edges[i], f, ss); } - userData = ccgSubSurf_getFaceUserData(ss, f); + userData = CCS_getFaceUserData(ss, f); memset(userData, 0, ss->meshIFC.faceUserSize); if (ss->useAgeCounts) *((int*) &userData[ss->faceUserAgeOffset]) = ss->currentAge; return f; } -static void *_face_getIECo(CCGFace *f, int lvl, int S, int x, int levels, int dataSize) { +static void *_face_getIECo(CCFace *f, int lvl, int S, int x, int levels, int dataSize) { int maxGridSize = 1 + (1<<(levels-1)); int spacing = 1<<(levels-lvl); byte *gridBase = FACE_getCenterData(f) + dataSize*(1 + S*(maxGridSize + maxGridSize*maxGridSize)); return &gridBase[dataSize*x*spacing]; } -static void *_face_getIFCo(CCGFace *f, int lvl, int S, int x, int y, int levels, int dataSize) { +static void *_face_getIFCo(CCFace *f, int lvl, int S, int x, int y, int levels, int dataSize) { int maxGridSize = 1 + (1<<(levels-1)); int spacing = 1<<(levels-lvl); byte *gridBase = FACE_getCenterData(f) + dataSize*(1 + S*(maxGridSize + maxGridSize*maxGridSize)); return &gridBase[dataSize*(maxGridSize + (y*maxGridSize + x)*spacing)]; } -static float *_face_getIFNo(CCGFace *f, int lvl, int S, int x, int y, int levels, int dataSize, int normalDataOffset) { +static float *_face_getIFNo(CCFace *f, int lvl, int S, int x, int y, int levels, int dataSize, int normalDataOffset) { int maxGridSize = 1 + (1<<(levels-1)); int spacing = 1<<(levels-lvl); byte *gridBase = FACE_getCenterData(f) + dataSize*(1 + S*(maxGridSize + maxGridSize*maxGridSize)); return (float*) &gridBase[dataSize*(maxGridSize + (y*maxGridSize + x)*spacing) + normalDataOffset]; } -static int _face_getVertIndex(CCGFace *f, CCGVert *v) { +static int _face_getVertIndex(CCFace *f, CCVert *v) { int i; for (i=0; i<f->numVerts; i++) if (FACE_getVerts(f)[i]==v) return i; return -1; } -static void *_face_getIFCoEdge(CCGFace *f, CCGEdge *e, int lvl, int eX, int eY, int levels, int dataSize) { +static void *_face_getIFCoEdge(CCFace *f, CCEdge *e, int lvl, int eX, int eY, int levels, int dataSize) { int maxGridSize = 1 + (1<<(levels-1)); int spacing = 1<<(levels-lvl); int S, x, y, cx, cy; @@ -575,10 +575,10 @@ static void *_face_getIFCoEdge(CCGFace *f, CCGEdge *e, int lvl, int eX, int eY, } return _face_getIFCo(f, levels, S, cx, cy, levels, dataSize); } -static float *_face_getIFNoEdge(CCGFace *f, CCGEdge *e, int lvl, int eX, int eY, int levels, int dataSize, int normalDataOffset) { +static float *_face_getIFNoEdge(CCFace *f, CCEdge *e, int lvl, int eX, int eY, int levels, int dataSize, int normalDataOffset) { return (float*) ((byte*) _face_getIFCoEdge(f, e, lvl, eX, eY, levels, dataSize) + normalDataOffset); } -void _face_calcIFNo(CCGFace *f, int lvl, int S, int x, int y, float *no, int levels, int dataSize) { +void _face_calcIFNo(CCFace *f, int lvl, int S, int x, int y, float *no, int levels, int dataSize) { float *a = _face_getIFCo(f, lvl, S, x+0, y+0, levels, dataSize); float *b = _face_getIFCo(f, lvl, S, x+1, y+0, levels, dataSize); float *c = _face_getIFCo(f, lvl, S, x+1, y+1, levels, dataSize); @@ -604,10 +604,10 @@ void _face_calcIFNo(CCGFace *f, int lvl, int S, int x, int y, float *no, int lev } } -static void _face_free(CCGFace *f, CCGSubSurf *ss) { +static void _face_free(CCFace *f, CSubSurf *ss) { CCGSUBSURF_free(ss, f); } -static void _face_unlinkMarkAndFree(CCGFace *f, CCGSubSurf *ss) { +static void _face_unlinkMarkAndFree(CCFace *f, CSubSurf *ss) { int j; for (j=0; j<f->numVerts; j++) { _vert_remFace(FACE_getVerts(f)[j], f); @@ -619,7 +619,7 @@ static void _face_unlinkMarkAndFree(CCGFace *f, CCGSubSurf *ss) { /***/ -CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator) { +CSubSurf *CCS_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *allocatorIFC, CCAllocHDL allocator) { if (!allocatorIFC) { allocatorIFC = _getStandardAllocatorIFC(); allocator = NULL; @@ -628,7 +628,7 @@ CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *a if (subdivLevels<1) { return NULL; } else { - CCGSubSurf *ss = allocatorIFC->alloc(allocator, sizeof(*ss)); + CSubSurf *ss = allocatorIFC->alloc(allocator, sizeof(*ss)); ss->allocatorIFC = *allocatorIFC; ss->allocator = allocator; @@ -667,9 +667,9 @@ CCGSubSurf *ccgSubSurf_new(CCGMeshIFC *ifc, int subdivLevels, CCGAllocatorIFC *a } } -void ccgSubSurf_free(CCGSubSurf *ss) { +void CCS_free(CSubSurf *ss) { CCGAllocatorIFC allocatorIFC = ss->allocatorIFC; - CCGAllocatorHDL allocator = ss->allocator; + CCAllocHDL allocator = ss->allocator; if (ss->syncState) { _ehash_free(ss->oldFMap, (EHEntryFreeFP) _face_free, ss); @@ -695,7 +695,7 @@ void ccgSubSurf_free(CCGSubSurf *ss) { } } -CCGError ccgSubSurf_setAllowEdgeCreation(CCGSubSurf *ss, int allowEdgeCreation, float defaultCreaseValue, void *defaultUserData) { +CCGError CCS_setAllowEdgeCreation(CSubSurf *ss, int allowEdgeCreation, float defaultCreaseValue, void *defaultUserData) { if (ss->defaultEdgeUserData) { CCGSUBSURF_free(ss, ss->defaultEdgeUserData); } @@ -712,7 +712,7 @@ CCGError ccgSubSurf_setAllowEdgeCreation(CCGSubSurf *ss, int allowEdgeCreation, return eCCGError_None; } -void ccgSubSurf_getAllowEdgeCreation(CCGSubSurf *ss, int *allowEdgeCreation_r, float *defaultCreaseValue_r, void *defaultUserData_r) { +void CCS_getAllowEdgeCreation(CSubSurf *ss, int *allowEdgeCreation_r, float *defaultCreaseValue_r, void *defaultUserData_r) { if (allowEdgeCreation_r) *allowEdgeCreation_r = ss->allowEdgeCreation; if (ss->allowEdgeCreation) { if (defaultCreaseValue_r) *defaultCreaseValue_r = ss->defaultCreaseValue; @@ -720,7 +720,7 @@ void ccgSubSurf_getAllowEdgeCreation(CCGSubSurf *ss, int *allowEdgeCreation_r, f } } -CCGError ccgSubSurf_setSubdivisionLevels(CCGSubSurf *ss, int subdivisionLevels) { +CCGError CCS_setSubdivisionLevels(CSubSurf *ss, int subdivisionLevels) { if (subdivisionLevels<=0) { return eCCGError_InvalidValue; } else if (subdivisionLevels!=ss->subdivLevels) { @@ -737,7 +737,7 @@ CCGError ccgSubSurf_setSubdivisionLevels(CCGSubSurf *ss, int subdivisionLevels) return eCCGError_None; } -void ccgSubSurf_getUseAgeCounts(CCGSubSurf *ss, int *useAgeCounts_r, int *vertUserOffset_r, int *edgeUserOffset_r, int *faceUserOffset_r) +void CCS_getUseAgeCounts(CSubSurf *ss, int *useAgeCounts_r, int *vertUserOffset_r, int *edgeUserOffset_r, int *faceUserOffset_r) { *useAgeCounts_r = ss->useAgeCounts; @@ -746,7 +746,7 @@ void ccgSubSurf_getUseAgeCounts(CCGSubSurf *ss, int *useAgeCounts_r, int *vertUs if (faceUserOffset_r) *faceUserOffset_r = ss->faceUserAgeOffset; } -CCGError ccgSubSurf_setUseAgeCounts(CCGSubSurf *ss, int useAgeCounts, int vertUserOffset, int edgeUserOffset, int faceUserOffset) { +CCGError CCS_setUseAgeCounts(CSubSurf *ss, int useAgeCounts, int vertUserOffset, int edgeUserOffset, int faceUserOffset) { if (useAgeCounts) { if ( (vertUserOffset+4>ss->meshIFC.vertUserSize) || (edgeUserOffset+4>ss->meshIFC.edgeUserSize) || @@ -766,7 +766,7 @@ CCGError ccgSubSurf_setUseAgeCounts(CCGSubSurf *ss, int useAgeCounts, int vertUs return eCCGError_None; } -CCGError ccgSubSurf_setCalcVertexNormals(CCGSubSurf *ss, int useVertNormals, int normalDataOffset) { +CCGError CCS_setCalcVertexNormals(CSubSurf *ss, int useVertNormals, int normalDataOffset) { if (useVertNormals) { if (normalDataOffset<0 || normalDataOffset+12>ss->meshIFC.vertDataSize) { return eCCGError_InvalidValue; @@ -784,7 +784,7 @@ CCGError ccgSubSurf_setCalcVertexNormals(CCGSubSurf *ss, int useVertNormals, int /***/ -CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss) { +CCGError CCS_initFullSync(CSubSurf *ss) { if (ss->syncState!=eSyncState_None) { return eCCGError_InvalidSyncState; } @@ -810,7 +810,7 @@ CCGError ccgSubSurf_initFullSync(CCGSubSurf *ss) { return eCCGError_None; } -CCGError ccgSubSurf_initPartialSync(CCGSubSurf *ss) { +CCGError CCS_initPartialSync(CSubSurf *ss) { if (ss->syncState!=eSyncState_None) { return eCCGError_InvalidSyncState; } @@ -822,12 +822,12 @@ CCGError ccgSubSurf_initPartialSync(CCGSubSurf *ss) { return eCCGError_None; } -CCGError ccgSubSurf_syncVertDel(CCGSubSurf *ss, CCGVertHDL vHDL) { +CCGError CCS_syncVertDel(CSubSurf *ss, CCVertHDL vHDL) { if (ss->syncState!=eSyncState_Partial) { return eCCGError_InvalidSyncState; } else { void **prevp; - CCGVert *v = _ehash_lookupWithPrev(ss->vMap, vHDL, &prevp); + CCVert *v = _ehash_lookupWithPrev(ss->vMap, vHDL, &prevp); if (!v || v->numFaces || v->numEdges) { return eCCGError_InvalidValue; @@ -840,12 +840,12 @@ CCGError ccgSubSurf_syncVertDel(CCGSubSurf *ss, CCGVertHDL vHDL) { return eCCGError_None; } -CCGError ccgSubSurf_syncEdgeDel(CCGSubSurf *ss, CCGEdgeHDL eHDL) { +CCGError CCS_syncEdgeDel(CSubSurf *ss, CCEdgeHDL eHDL) { if (ss->syncState!=eSyncState_Partial) { return eCCGError_InvalidSyncState; } else { void **prevp; - CCGEdge *e = _ehash_lookupWithPrev(ss->eMap, eHDL, &prevp); + CCEdge *e = _ehash_lookupWithPrev(ss->eMap, eHDL, &prevp); if (!e || e->numFaces) { return eCCGError_InvalidValue; @@ -858,12 +858,12 @@ CCGError ccgSubSurf_syncEdgeDel(CCGSubSurf *ss, CCGEdgeHDL eHDL) { return eCCGError_None; } -CCGError ccgSubSurf_syncFaceDel(CCGSubSurf *ss, CCGFaceHDL fHDL) { +CCGError CCS_syncFaceDel(CSubSurf *ss, CCFaceHDL fHDL) { if (ss->syncState!=eSyncState_Partial) { return eCCGError_InvalidSyncState; } else { void **prevp; - CCGFace *f = _ehash_lookupWithPrev(ss->fMap, fHDL, &prevp); + CCFace *f = _ehash_lookupWithPrev(ss->fMap, fHDL, &prevp); if (!f) { return eCCGError_InvalidValue; @@ -876,9 +876,9 @@ CCGError ccgSubSurf_syncFaceDel(CCGSubSurf *ss, CCGFaceHDL fHDL) { return eCCGError_None; } -CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, void *vertData, int seam, CCGVert **v_r) { +CCGError CCS_syncVert(CSubSurf *ss, CCVertHDL vHDL, void *vertData, int seam, CCVert **v_r) { void **prevp; - CCGVert *v = NULL; + CCVert *v = NULL; short seamflag = (seam)? Vert_eSeam: 0; if (ss->syncState==eSyncState_Partial) { @@ -895,12 +895,12 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, void *vertData, in v->flags = Vert_eEffected|seamflag; for (i=0; i<v->numEdges; i++) { - CCGEdge *e = v->edges[i]; + CCEdge *e = v->edges[i]; e->v0->flags |= Vert_eEffected; e->v1->flags |= Vert_eEffected; } for (i=0; i<v->numFaces; i++) { - CCGFace *f = v->faces[i]; + CCFace *f = v->faces[i]; for (j=0; j<f->numVerts; j++) { FACE_getVerts(f)[j]->flags |= Vert_eEffected; } @@ -933,15 +933,15 @@ CCGError ccgSubSurf_syncVert(CCGSubSurf *ss, CCGVertHDL vHDL, void *vertData, in return eCCGError_None; } -CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0, CCGVertHDL e_vHDL1, float crease, CCGEdge **e_r) { +CCGError CCS_syncEdge(CSubSurf *ss, CCEdgeHDL eHDL, CCVertHDL e_vHDL0, CCVertHDL e_vHDL1, float crease, CCEdge **e_r) { void **prevp; - CCGEdge *e = NULL, *eNew; + CCEdge *e = NULL, *eNew; if (ss->syncState==eSyncState_Partial) { e = _ehash_lookupWithPrev(ss->eMap, eHDL, &prevp); if (!e || e->v0->vHDL!=e_vHDL0 || e->v1->vHDL!=e_vHDL1 || crease!=e->crease) { - CCGVert *v0 = _ehash_lookup(ss->vMap, e_vHDL0); - CCGVert *v1 = _ehash_lookup(ss->vMap, e_vHDL1); + CCVert *v0 = _ehash_lookup(ss->vMap, e_vHDL0); + CCVert *v1 = _ehash_lookup(ss->vMap, e_vHDL1); eNew = _edge_new(eHDL, v0, v1, crease, ss); @@ -966,8 +966,8 @@ CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0 e = _ehash_lookupWithPrev(ss->oldEMap, eHDL, &prevp); if (!e || e->v0->vHDL!=e_vHDL0 || e->v1->vHDL!=e_vHDL1|| e->crease!=crease) { - CCGVert *v0 = _ehash_lookup(ss->vMap, e_vHDL0); - CCGVert *v1 = _ehash_lookup(ss->vMap, e_vHDL1); + CCVert *v0 = _ehash_lookup(ss->vMap, e_vHDL0); + CCVert *v1 = _ehash_lookup(ss->vMap, e_vHDL1); e = _edge_new(eHDL, v0, v1, crease, ss); _ehash_insert(ss->eMap, (EHEntry*) e); e->v0->flags |= Vert_eEffected; @@ -987,9 +987,9 @@ CCGError ccgSubSurf_syncEdge(CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0 return eCCGError_None; } -CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGVertHDL *vHDLs, CCGFace **f_r) { +CCGError CCS_syncFace(CSubSurf *ss, CCFaceHDL fHDL, int numVerts, CCVertHDL *vHDLs, CCFace **f_r) { void **prevp; - CCGFace *f = NULL, *fNew; + CCFace *f = NULL, *fNew; int j, k, topologyChanged = 0; if (numVerts>ss->lenTempArrays) { @@ -1054,12 +1054,12 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV if (!ss->tempEdges[k]) { if (ss->allowEdgeCreation) { - CCGEdge *e = ss->tempEdges[k] = _edge_new((CCGEdgeHDL) -1, ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts], ss->defaultCreaseValue, ss); + CCEdge *e = ss->tempEdges[k] = _edge_new((CCEdgeHDL) -1, ss->tempVerts[k], ss->tempVerts[(k+1)%numVerts], ss->defaultCreaseValue, ss); _ehash_insert(ss->eMap, (EHEntry*) e); e->v0->flags |= Vert_eEffected; e->v1->flags |= Vert_eEffected; if (ss->meshIFC.edgeUserSize) { - memcpy(ccgSubSurf_getEdgeUserData(ss, e), ss->defaultEdgeUserData, ss->meshIFC.edgeUserSize); + memcpy(CCS_getEdgeUserData(ss, e), ss->defaultEdgeUserData, ss->meshIFC.edgeUserSize); } } else { return eCCGError_InvalidValue; @@ -1101,12 +1101,12 @@ CCGError ccgSubSurf_syncFace(CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGV return eCCGError_None; } -static void ccgSubSurf__sync(CCGSubSurf *ss); -CCGError ccgSubSurf_processSync(CCGSubSurf *ss) { +static void CCS__sync(CSubSurf *ss); +CCGError CCS_processSync(CSubSurf *ss) { if (ss->syncState==eSyncState_Partial) { ss->syncState = eSyncState_None; - ccgSubSurf__sync(ss); + CCS__sync(ss); } else if (ss->syncState) { _ehash_free(ss->oldFMap, (EHEntryFreeFP) _face_unlinkMarkAndFree, ss); _ehash_free(ss->oldEMap, (EHEntryFreeFP) _edge_unlinkMarkAndFree, ss); @@ -1122,7 +1122,7 @@ CCGError ccgSubSurf_processSync(CCGSubSurf *ss) { ss->syncState = eSyncState_None; - ccgSubSurf__sync(ss); + CCS__sync(ss); } else { return eCCGError_InvalidSyncState; } @@ -1130,10 +1130,10 @@ CCGError ccgSubSurf_processSync(CCGSubSurf *ss) { return eCCGError_None; } -static void ccgSubSurf__sync(CCGSubSurf *ss) { - CCGVert **effectedV; - CCGEdge **effectedE; - CCGFace **effectedF; +static void CCS__sync(CSubSurf *ss) { + CCVert **effectedV; + CCEdge **effectedE; + CCFace **effectedF; int numEffectedV, numEffectedE, numEffectedF; int subdivLevels = ss->subdivLevels; int vertDataSize = ss->meshIFC.vertDataSize; @@ -1148,13 +1148,13 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { effectedF = CCGSUBSURF_alloc(ss, sizeof(*effectedF)*ss->fMap->numEntries); numEffectedV = numEffectedE = numEffectedF = 0; for (i=0; i<ss->vMap->curSize; i++) { - CCGVert *v = (CCGVert*) ss->vMap->buckets[i]; + CCVert *v = (CCVert*) ss->vMap->buckets[i]; for (; v; v = v->next) { if (v->flags&Vert_eEffected) { effectedV[numEffectedV++] = v; for (j=0; j<v->numEdges; j++) { - CCGEdge *e = v->edges[j]; + CCEdge *e = v->edges[j]; if (!(e->flags&Edge_eEffected)) { effectedE[numEffectedE++] = e; e->flags |= Edge_eEffected; @@ -1162,7 +1162,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } for (j=0; j<v->numFaces; j++) { - CCGFace *f = v->faces[j]; + CCFace *f = v->faces[j]; if (!(f->flags&Face_eEffected)) { effectedF[numEffectedF++] = f; f->flags |= Face_eEffected; @@ -1180,7 +1180,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { nextLvl = curLvl+1; for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) { - CCGFace *f = effectedF[ptrIdx]; + CCFace *f = effectedF[ptrIdx]; void *co = FACE_getCenterData(f); VertDataZero(co); for (i=0; i<f->numVerts; i++) { @@ -1191,7 +1191,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { f->flags = 0; } for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) { - CCGEdge *e = effectedE[ptrIdx]; + CCEdge *e = effectedE[ptrIdx]; void *co = EDGE_getCo(e, nextLvl, 1); float sharpness = EDGE_getSharpness(e, curLvl); @@ -1204,7 +1204,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { VertDataCopy(q, VERT_getCo(e->v0, curLvl)); VertDataAdd(q, VERT_getCo(e->v1, curLvl)); for (i=0; i<e->numFaces; i++) { - CCGFace *f = e->faces[i]; + CCFace *f = e->faces[i]; VertDataAdd(q, FACE_getCenterData(f)); numFaces++; } @@ -1223,7 +1223,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { // edge flags cleared later } for (ptrIdx=0; ptrIdx<numEffectedV; ptrIdx++) { - CCGVert *v = effectedV[ptrIdx]; + CCVert *v = effectedV[ptrIdx]; void *co = VERT_getCo(v, curLvl); void *nCo = VERT_getCo(v, nextLvl); int sharpCount = 0, allSharp = 1; @@ -1231,7 +1231,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { int seam = VERT_seam(v), seamEdges = 0; for (i=0; i<v->numEdges; i++) { - CCGEdge *e = v->edges[i]; + CCEdge *e = v->edges[i]; float sharpness = EDGE_getSharpness(e, curLvl); if (seam && _edge_isBoundary(e)) @@ -1262,7 +1262,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { VertDataZero(r); for (i=0; i<v->numEdges; i++) { - CCGEdge *e = v->edges[i]; + CCEdge *e = v->edges[i]; if (_edge_isBoundary(e)) { VertDataAdd(r, VERT_getCo(_edge_getOtherVert(e, v), curLvl)); numBoundary++; @@ -1277,14 +1277,14 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { VertDataZero(q); for (i=0; i<v->numFaces; i++) { - CCGFace *f = v->faces[i]; + CCFace *f = v->faces[i]; VertDataAdd(q, FACE_getCenterData(f)); numFaces++; } VertDataMulN(q, 1.0f/numFaces); VertDataZero(r); for (i=0; i<v->numEdges; i++) { - CCGEdge *e = v->edges[i]; + CCEdge *e = v->edges[i]; VertDataAdd(r, VERT_getCo(_edge_getOtherVert(e, v), curLvl)); numEdges++; } @@ -1307,16 +1307,16 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } for (i=0; i<v->numEdges; i++) { - CCGEdge *e = v->edges[i]; + CCEdge *e = v->edges[i]; float sharpness = EDGE_getSharpness(e, curLvl); if (seam) { if (_edge_isBoundary(e)) { - CCGVert *oV = _edge_getOtherVert(e, v); + CCVert *oV = _edge_getOtherVert(e, v); VertDataAdd(q, VERT_getCo(oV, curLvl)); } } else if (sharpness != 0.0) { - CCGVert *oV = _edge_getOtherVert(e, v); + CCVert *oV = _edge_getOtherVert(e, v); VertDataAdd(q, VERT_getCo(oV, curLvl)); } } @@ -1348,34 +1348,34 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { if (ss->useAgeCounts) { for (i=0; i<numEffectedV; i++) { - CCGVert *v = effectedV[i]; - byte *userData = ccgSubSurf_getVertUserData(ss, v); + CCVert *v = effectedV[i]; + byte *userData = CCS_getVertUserData(ss, v); *((int*) &userData[ss->vertUserAgeOffset]) = ss->currentAge; } for (i=0; i<numEffectedE; i++) { - CCGEdge *e = effectedE[i]; - byte *userData = ccgSubSurf_getEdgeUserData(ss, e); + CCEdge *e = effectedE[i]; + byte *userData = CCS_getEdgeUserData(ss, e); *((int*) &userData[ss->edgeUserAgeOffset]) = ss->currentAge; } for (i=0; i<numEffectedF; i++) { - CCGFace *f = effectedF[i]; - byte *userData = ccgSubSurf_getFaceUserData(ss, f); + CCFace *f = effectedF[i]; + byte *userData = CCS_getFaceUserData(ss, f); *((int*) &userData[ss->faceUserAgeOffset]) = ss->currentAge; } } for (i=0; i<numEffectedE; i++) { - CCGEdge *e = effectedE[i]; + CCEdge *e = effectedE[i]; VertDataCopy(EDGE_getCo(e, nextLvl, 0), VERT_getCo(e->v0, nextLvl)); VertDataCopy(EDGE_getCo(e, nextLvl, 2), VERT_getCo(e->v1, nextLvl)); } for (i=0; i<numEffectedF; i++) { - CCGFace *f = effectedF[i]; + CCFace *f = effectedF[i]; for (S=0; S<f->numVerts; S++) { - CCGEdge *e = FACE_getEdges(f)[S]; - CCGEdge *prevE = FACE_getEdges(f)[(S+f->numVerts-1)%f->numVerts]; + CCEdge *e = FACE_getEdges(f)[S]; + CCEdge *prevE = FACE_getEdges(f)[(S+f->numVerts-1)%f->numVerts]; VertDataCopy(FACE_getIFCo(f, nextLvl, S, 0, 0), FACE_getCenterData(f)); VertDataCopy(FACE_getIECo(f, nextLvl, S, 0), FACE_getCenterData(f)); @@ -1393,7 +1393,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { nextLvl = curLvl+1; for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) { - CCGFace *f = (CCGFace*) effectedF[ptrIdx]; + CCFace *f = (CCFace*) effectedF[ptrIdx]; /* interior face midpoints * o old interior face points @@ -1472,7 +1472,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { * o new interior face midpoints */ for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) { - CCGEdge *e = (CCGEdge*) effectedE[ptrIdx]; + CCEdge *e = (CCEdge*) effectedE[ptrIdx]; float sharpness = EDGE_getSharpness(e, curLvl); if (_edge_isBoundary(e) || sharpness>1.0) { @@ -1498,7 +1498,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { VertDataAdd(q, co1); for (i=0; i<e->numFaces; i++) { - CCGFace *f = e->faces[i]; + CCFace *f = e->faces[i]; VertDataAdd(q, _face_getIFCoEdge(f, e, nextLvl, fx, 1, subdivLevels, vertDataSize)); numFaces++; } @@ -1523,7 +1523,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { * o new interior face midpoints */ for (ptrIdx=0; ptrIdx<numEffectedV; ptrIdx++) { - CCGVert *v = (CCGVert*) effectedV[ptrIdx]; + CCVert *v = (CCVert*) effectedV[ptrIdx]; void *co = VERT_getCo(v, curLvl); void *nCo = VERT_getCo(v, nextLvl); int sharpCount = 0, allSharp = 1; @@ -1531,7 +1531,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { int seam = VERT_seam(v), seamEdges = 0; for (i=0; i<v->numEdges; i++) { - CCGEdge *e = v->edges[i]; + CCEdge *e = v->edges[i]; float sharpness = EDGE_getSharpness(e, curLvl); if (seam && _edge_isBoundary(e)) @@ -1562,7 +1562,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { VertDataZero(r); for (i=0; i<v->numEdges; i++) { - CCGEdge *e = v->edges[i]; + CCEdge *e = v->edges[i]; if (_edge_isBoundary(e)) { VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1, vertDataSize)); numBoundary++; @@ -1579,14 +1579,14 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { VertDataZero(q); for (i=0; i<v->numFaces; i++) { - CCGFace *f = v->faces[i]; + CCFace *f = v->faces[i]; VertDataAdd(q, FACE_getIFCo(f, nextLvl, _face_getVertIndex(f,v), cornerIdx, cornerIdx)); numFaces++; } VertDataMulN(q, 1.0f/numFaces); VertDataZero(r); for (i=0; i<v->numEdges; i++) { - CCGEdge *e = v->edges[i]; + CCEdge *e = v->edges[i]; VertDataAdd(r, _edge_getCoVert(e, v, curLvl, 1,vertDataSize)); numEdges++; } @@ -1609,7 +1609,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } for (i=0; i<v->numEdges; i++) { - CCGEdge *e = v->edges[i]; + CCEdge *e = v->edges[i]; float sharpness = EDGE_getSharpness(e, curLvl); if (seam) { @@ -1649,7 +1649,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { * o new interior face midpoints */ for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) { - CCGEdge *e = (CCGEdge*) effectedE[ptrIdx]; + CCEdge *e = (CCEdge*) effectedE[ptrIdx]; float sharpness = EDGE_getSharpness(e, curLvl); int sharpCount = 0; float avgSharpness = 0.0; @@ -1691,7 +1691,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { VertDataAdd(r, EDGE_getCo(e, curLvl, x-1)); VertDataAdd(r, EDGE_getCo(e, curLvl, x+1)); for (i=0; i<e->numFaces; i++) { - CCGFace *f = e->faces[i]; + CCFace *f = e->faces[i]; VertDataAdd(q, _face_getIFCoEdge(f, e, nextLvl, fx-1, 1, subdivLevels, vertDataSize)); VertDataAdd(q, _face_getIFCoEdge(f, e, nextLvl, fx+1, 1, subdivLevels, vertDataSize)); @@ -1723,7 +1723,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) { - CCGFace *f = (CCGFace*) effectedF[ptrIdx]; + CCFace *f = (CCFace*) effectedF[ptrIdx]; /* interior center point shift * o old face center point (shifting) @@ -1809,15 +1809,15 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { gridSize = 1 + (1<<((nextLvl)-1)); cornerIdx = gridSize-1; for (i=0; i<numEffectedE; i++) { - CCGEdge *e = effectedE[i]; + CCEdge *e = effectedE[i]; VertDataCopy(EDGE_getCo(e, nextLvl, 0), VERT_getCo(e->v0, nextLvl)); VertDataCopy(EDGE_getCo(e, nextLvl, edgeSize-1), VERT_getCo(e->v1, nextLvl)); } for (i=0; i<numEffectedF; i++) { - CCGFace *f = effectedF[i]; + CCFace *f = effectedF[i]; for (S=0; S<f->numVerts; S++) { - CCGEdge *e = FACE_getEdges(f)[S]; - CCGEdge *prevE = FACE_getEdges(f)[(S+f->numVerts-1)%f->numVerts]; + CCEdge *e = FACE_getEdges(f)[S]; + CCEdge *prevE = FACE_getEdges(f)[(S+f->numVerts-1)%f->numVerts]; VertDataCopy(FACE_getIFCo(f, nextLvl, S, 0, 0), FACE_getCenterData(f)); VertDataCopy(FACE_getIECo(f, nextLvl, S, 0), FACE_getCenterData(f)); @@ -1846,7 +1846,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { int normalDataOffset = ss->normalDataOffset; for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) { - CCGFace *f = (CCGFace*) effectedF[ptrIdx]; + CCFace *f = (CCFace*) effectedF[ptrIdx]; int S, x, y; for (S=0; S<f->numVerts; S++) { @@ -1866,7 +1866,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) { - CCGFace *f = (CCGFace*) effectedF[ptrIdx]; + CCFace *f = (CCFace*) effectedF[ptrIdx]; int S, x, y; float no[3]; @@ -1922,13 +1922,13 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } // XXX can I reduce the number of normalisations here? for (ptrIdx=0; ptrIdx<numEffectedV; ptrIdx++) { - CCGVert *v = (CCGVert*) effectedV[ptrIdx]; + CCVert *v = (CCVert*) effectedV[ptrIdx]; float length, *no = _vert_getNo(v, lvl, vertDataSize, normalDataOffset); NormZero(no); for (i=0; i<v->numFaces; i++) { - CCGFace *f = v->faces[i]; + CCFace *f = v->faces[i]; NormAdd(no, FACE_getIFNo(f, lvl, _face_getVertIndex(f,v), gridSize-1, gridSize-1)); } @@ -1944,19 +1944,19 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } for (i=0; i<v->numFaces; i++) { - CCGFace *f = v->faces[i]; + CCFace *f = v->faces[i]; NormCopy(FACE_getIFNo(f, lvl, _face_getVertIndex(f,v), gridSize-1, gridSize-1), no); } } for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) { - CCGEdge *e = (CCGEdge*) effectedE[ptrIdx]; + CCEdge *e = (CCEdge*) effectedE[ptrIdx]; if (e->numFaces) { - CCGFace *fLast = e->faces[e->numFaces-1]; + CCFace *fLast = e->faces[e->numFaces-1]; int x; for (i=0; i<e->numFaces-1; i++) { - CCGFace *f = e->faces[i]; + CCFace *f = e->faces[i]; for (x=1; x<edgeSize-1; x++) { NormAdd(_face_getIFNoEdge(fLast, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset), @@ -1965,7 +1965,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } for (i=0; i<e->numFaces-1; i++) { - CCGFace *f = e->faces[i]; + CCFace *f = e->faces[i]; for (x=1; x<edgeSize-1; x++) { NormCopy(_face_getIFNoEdge(f, e, lvl, x, 0, subdivLevels, vertDataSize, normalDataOffset), @@ -1975,7 +1975,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } } for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) { - CCGFace *f = (CCGFace*) effectedF[ptrIdx]; + CCFace *f = (CCFace*) effectedF[ptrIdx]; int S; for (S=0; S<f->numVerts; S++) { @@ -1984,7 +1984,7 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { } } for (ptrIdx=0; ptrIdx<numEffectedF; ptrIdx++) { - CCGFace *f = (CCGFace*) effectedF[ptrIdx]; + CCFace *f = (CCFace*) effectedF[ptrIdx]; int S, x, y; for (S=0; S<f->numVerts; S++) { @@ -2009,11 +2009,11 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { #undef FACE_getIFNo for (ptrIdx=0; ptrIdx<numEffectedV; ptrIdx++) { - CCGVert *v = effectedV[ptrIdx]; + CCVert *v = effectedV[ptrIdx]; v->flags = 0; } for (ptrIdx=0; ptrIdx<numEffectedE; ptrIdx++) { - CCGEdge *e = effectedE[ptrIdx]; + CCEdge *e = effectedE[ptrIdx]; e->flags = 0; } @@ -2029,43 +2029,43 @@ static void ccgSubSurf__sync(CCGSubSurf *ss) { /*** External API accessor functions ***/ -int ccgSubSurf_getNumVerts(CCGSubSurf *ss) { +int CCS_getNumVerts(CSubSurf *ss) { return ss->vMap->numEntries; } -int ccgSubSurf_getNumEdges(CCGSubSurf *ss) { +int CCS_getNumEdges(CSubSurf *ss) { return ss->eMap->numEntries; } -int ccgSubSurf_getNumTessFaces(CCGSubSurf *ss) { +int CCS_getNumFaces(CSubSurf *ss) { return ss->fMap->numEntries; } -CCGVert *ccgSubSurf_getVert(CCGSubSurf *ss, CCGVertHDL v) { - return (CCGVert*) _ehash_lookup(ss->vMap, v); +CCVert *CCS_getVert(CSubSurf *ss, CCVertHDL v) { + return (CCVert*) _ehash_lookup(ss->vMap, v); } -CCGEdge *ccgSubSurf_getEdge(CCGSubSurf *ss, CCGEdgeHDL e) { - return (CCGEdge*) _ehash_lookup(ss->eMap, e); +CCEdge *CCS_getEdge(CSubSurf *ss, CCEdgeHDL e) { + return (CCEdge*) _ehash_lookup(ss->eMap, e); } -CCGFace *ccgSubSurf_getFace(CCGSubSurf *ss, CCGFaceHDL f) { - return (CCGFace*) _ehash_lookup(ss->fMap, f); +CCFace *CCS_getFace(CSubSurf *ss, CCFaceHDL f) { + return (CCFace*) _ehash_lookup(ss->fMap, f); } -int ccgSubSurf_getSubdivisionLevels(CCGSubSurf *ss) { +int CCS_getSubdivisionLevels(CSubSurf *ss) { return ss->subdivLevels; } -int ccgSubSurf_getEdgeSize(CCGSubSurf *ss) { - return ccgSubSurf_getEdgeLevelSize(ss, ss->subdivLevels); +int CCS_getEdgeSize(CSubSurf *ss) { + return CCS_getEdgeLevelSize(ss, ss->subdivLevels); } -int ccgSubSurf_getEdgeLevelSize(CCGSubSurf *ss, int level) { +int CCS_getEdgeLevelSize(CSubSurf *ss, int level) { if (level<1 || level>ss->subdivLevels) { return -1; } else { return 1 + (1<<level); } } -int ccgSubSurf_getGridSize(CCGSubSurf *ss) { - return ccgSubSurf_getGridLevelSize(ss, ss->subdivLevels); +int CCS_getGridSize(CSubSurf *ss) { + return CCS_getGridLevelSize(ss, ss->subdivLevels); } -int ccgSubSurf_getGridLevelSize(CCGSubSurf *ss, int level) { +int CCS_getGridLevelSize(CSubSurf *ss, int level) { if (level<1 || level>ss->subdivLevels) { return -1; } else { @@ -2075,44 +2075,44 @@ int ccgSubSurf_getGridLevelSize(CCGSubSurf *ss, int level) { /* Vert accessors */ -CCGVertHDL ccgSubSurf_getVertVertHandle(CCGVert *v) { +CCVertHDL CCS_getVertVertHandle(CCVert *v) { return v->vHDL; } -int ccgSubSurf_getVertAge(CCGSubSurf *ss, CCGVert *v) { +int CCS_getVertAge(CSubSurf *ss, CCVert *v) { if (ss->useAgeCounts) { - byte *userData = ccgSubSurf_getVertUserData(ss, v); + byte *userData = CCS_getVertUserData(ss, v); return ss->currentAge - *((int*) &userData[ss->vertUserAgeOffset]); } else { return 0; } } -void *ccgSubSurf_getVertUserData(CCGSubSurf *ss, CCGVert *v) { +void *CCS_getVertUserData(CSubSurf *ss, CCVert *v) { return VERT_getLevelData(v) + ss->meshIFC.vertDataSize*(ss->subdivLevels+1); } -int ccgSubSurf_getVertNumFaces(CCGVert *v) { +int CCS_getVertNumFaces(CCVert *v) { return v->numFaces; } -CCGFace *ccgSubSurf_getVertFace(CCGVert *v, int index) { +CCFace *CCS_getVertFace(CCVert *v, int index) { if (index<0 || index>=v->numFaces) { return NULL; } else { return v->faces[index]; } } -int ccgSubSurf_getVertNumEdges(CCGVert *v) { +int CCS_getVertNumEdges(CCVert *v) { return v->numEdges; } -CCGEdge *ccgSubSurf_getVertEdge(CCGVert *v, int index) { +CCEdge *CCS_getVertEdge(CCVert *v, int index) { if (index<0 || index>=v->numEdges) { return NULL; } else { return v->edges[index]; } } -void *ccgSubSurf_getVertData(CCGSubSurf *ss, CCGVert *v) { - return ccgSubSurf_getVertLevelData(ss, v, ss->subdivLevels); +void *CCS_getVertData(CSubSurf *ss, CCVert *v) { + return CCS_getVertLevelData(ss, v, ss->subdivLevels); } -void *ccgSubSurf_getVertLevelData(CCGSubSurf *ss, CCGVert *v, int level) { +void *CCS_getVertLevelData(CSubSurf *ss, CCVert *v, int level) { if (level<0 || level>ss->subdivLevels) { return NULL; } else { @@ -2122,88 +2122,88 @@ void *ccgSubSurf_getVertLevelData(CCGSubSurf *ss, CCGVert *v, int level) { /* Edge accessors */ -CCGEdgeHDL ccgSubSurf_getEdgeEdgeHandle(CCGEdge *e) { +CCEdgeHDL CCS_getEdgeEdgeHandle(CCEdge *e) { return e->eHDL; } -int ccgSubSurf_getEdgeAge(CCGSubSurf *ss, CCGEdge *e) { +int CCS_getEdgeAge(CSubSurf *ss, CCEdge *e) { if (ss->useAgeCounts) { - byte *userData = ccgSubSurf_getEdgeUserData(ss, e); + byte *userData = CCS_getEdgeUserData(ss, e); return ss->currentAge - *((int*) &userData[ss->edgeUserAgeOffset]); } else { return 0; } } -void *ccgSubSurf_getEdgeUserData(CCGSubSurf *ss, CCGEdge *e) { +void *CCS_getEdgeUserData(CSubSurf *ss, CCEdge *e) { return EDGE_getLevelData(e) + ss->meshIFC.vertDataSize *((ss->subdivLevels+1) + (1<<(ss->subdivLevels+1))-1); } -int ccgSubSurf_getEdgeNumFaces(CCGEdge *e) { +int CCS_getEdgeNumFaces(CCEdge *e) { return e->numFaces; } -CCGFace *ccgSubSurf_getEdgeFace(CCGEdge *e, int index) { +CCFace *CCS_getEdgeFace(CCEdge *e, int index) { if (index<0 || index>=e->numFaces) { return NULL; } else { return e->faces[index]; } } -CCGVert *ccgSubSurf_getEdgeVert0(CCGEdge *e) { +CCVert *CCS_getEdgeVert0(CCEdge *e) { return e->v0; } -CCGVert *ccgSubSurf_getEdgeVert1(CCGEdge *e) { +CCVert *CCS_getEdgeVert1(CCEdge *e) { return e->v1; } -void *ccgSubSurf_getEdgeDataArray(CCGSubSurf *ss, CCGEdge *e) { - return ccgSubSurf_getEdgeData(ss, e, 0); +void *CCS_getEdgeDataArray(CSubSurf *ss, CCEdge *e) { + return CCS_getEdgeData(ss, e, 0); } -void *ccgSubSurf_getEdgeData(CCGSubSurf *ss, CCGEdge *e, int x) { - return ccgSubSurf_getEdgeLevelData(ss, e, x, ss->subdivLevels); +void *CCS_getEdgeData(CSubSurf *ss, CCEdge *e, int x) { + return CCS_getEdgeLevelData(ss, e, x, ss->subdivLevels); } -void *ccgSubSurf_getEdgeLevelData(CCGSubSurf *ss, CCGEdge *e, int x, int level) { +void *CCS_getEdgeLevelData(CSubSurf *ss, CCEdge *e, int x, int level) { if (level<0 || level>ss->subdivLevels) { return NULL; } else { return _edge_getCo(e, level, x, ss->meshIFC.vertDataSize); } } -float ccgSubSurf_getEdgeCrease(CCGEdge *e) { +float CCS_getEdgeCrease(CCEdge *e) { return e->crease; } /* Face accessors */ -CCGFaceHDL ccgSubSurf_getFaceFaceHandle(CCGSubSurf *ss, CCGFace *f) { +CCFaceHDL CCS_getFaceFaceHandle(CSubSurf *ss, CCFace *f) { return f->fHDL; } -int ccgSubSurf_getFaceAge(CCGSubSurf *ss, CCGFace *f) { +int CCS_getFaceAge(CSubSurf *ss, CCFace *f) { if (ss->useAgeCounts) { - byte *userData = ccgSubSurf_getFaceUserData(ss, f); + byte *userData = CCS_getFaceUserData(ss, f); return ss->currentAge - *((int*) &userData[ss->faceUserAgeOffset]); } else { return 0; } } -void *ccgSubSurf_getFaceUserData(CCGSubSurf *ss, CCGFace *f) { +void *CCS_getFaceUserData(CSubSurf *ss, CCFace *f) { int maxGridSize = 1 + (1<<(ss->subdivLevels-1)); return FACE_getCenterData(f) + ss->meshIFC.vertDataSize *(1 + f->numVerts*maxGridSize + f->numVerts*maxGridSize*maxGridSize); } -int ccgSubSurf_getFaceNumVerts(CCGFace *f) { +int CCS_getFaceNumVerts(CCFace *f) { return f->numVerts; } -CCGVert *ccgSubSurf_getFaceVert(CCGSubSurf *ss, CCGFace *f, int index) { +CCVert *CCS_getFaceVert(CSubSurf *ss, CCFace *f, int index) { if (index<0 || index>=f->numVerts) { return NULL; } else { return FACE_getVerts(f)[index]; } } -CCGEdge *ccgSubSurf_getFaceEdge(CCGSubSurf *ss, CCGFace *f, int index) { +CCEdge *CCS_getFaceEdge(CSubSurf *ss, CCFace *f, int index) { if (index<0 || index>=f->numVerts) { return NULL; } else { return FACE_getEdges(f)[index]; } } -int ccgSubSurf_getFaceEdgeIndex(CCGFace *f, CCGEdge *e) { +int CCS_getFaceEdgeIndex(CCFace *f, CCEdge *e) { int i; for (i=0; i<f->numVerts; i++) @@ -2212,88 +2212,88 @@ int ccgSubSurf_getFaceEdgeIndex(CCGFace *f, CCGEdge *e) { return -1; } -void *ccgSubSurf_getFaceCenterData(CCGFace *f) { +void *CCS_getFaceCenterData(CCFace *f) { return FACE_getCenterData(f); } -void *ccgSubSurf_getFaceGridEdgeDataArray(CCGSubSurf *ss, CCGFace *f, int gridIndex) { - return ccgSubSurf_getFaceGridEdgeData(ss, f, gridIndex, 0); +void *CCS_getFaceGridEdgeDataArray(CSubSurf *ss, CCFace *f, int gridIndex) { + return CCS_getFaceGridEdgeData(ss, f, gridIndex, 0); } -void *ccgSubSurf_getFaceGridEdgeData(CCGSubSurf *ss, CCGFace *f, int gridIndex, int x) { +void *CCS_getFaceGridEdgeData(CSubSurf *ss, CCFace *f, int gridIndex, int x) { return _face_getIECo(f, ss->subdivLevels, gridIndex, x, ss->subdivLevels, ss->meshIFC.vertDataSize); } -void *ccgSubSurf_getFaceGridDataArray(CCGSubSurf *ss, CCGFace *f, int gridIndex) { - return ccgSubSurf_getFaceGridData(ss, f, gridIndex, 0, 0); +void *CCS_getFaceGridDataArray(CSubSurf *ss, CCFace *f, int gridIndex) { + return CCS_getFaceGridData(ss, f, gridIndex, 0, 0); } -void *ccgSubSurf_getFaceGridData(CCGSubSurf *ss, CCGFace *f, int gridIndex, int x, int y) { +void *CCS_getFaceGridData(CSubSurf *ss, CCFace *f, int gridIndex, int x, int y) { return _face_getIFCo(f, ss->subdivLevels, gridIndex, x, y, ss->subdivLevels, ss->meshIFC.vertDataSize); } /*** External API iterator functions ***/ -CCGVertIterator *ccgSubSurf_getVertIterator(CCGSubSurf *ss) { - return (CCGVertIterator*) _ehashIterator_new(ss->vMap); +CCVertIterator *CCS_getVertIterator(CSubSurf *ss) { + return (CCVertIterator*) _ehashIterator_new(ss->vMap); } -CCGEdgeIterator *ccgSubSurf_getEdgeIterator(CCGSubSurf *ss) { - return (CCGEdgeIterator*) _ehashIterator_new(ss->eMap); +CCEdgeIterator *CCS_getEdgeIterator(CSubSurf *ss) { + return (CCEdgeIterator*) _ehashIterator_new(ss->eMap); } -CCGFaceIterator *ccgSubSurf_getFaceIterator(CCGSubSurf *ss) { - return (CCGFaceIterator*) _ehashIterator_new(ss->fMap); +CCFaceIterator *CCS_getFaceIterator(CSubSurf *ss) { + return (CCFaceIterator*) _ehashIterator_new(ss->fMap); } -CCGVert *ccgVertIterator_getCurrent(CCGVertIterator *vi) { - return (CCGVert*) _ehashIterator_getCurrent((EHashIterator*) vi); +CCVert *CCVIter_getCurrent(CCVertIterator *vi) { + return (CCVert*) _ehashIterator_getCurrent((EHashIterator*) vi); } -int ccgVertIterator_isStopped(CCGVertIterator *vi) { +int CCVIter_isStopped(CCVertIterator *vi) { return _ehashIterator_isStopped((EHashIterator*) vi); } -void ccgVertIterator_next(CCGVertIterator *vi) { +void CCVIter_next(CCVertIterator *vi) { _ehashIterator_next((EHashIterator*) vi); } -void ccgVertIterator_free(CCGVertIterator *vi) { +void CCVIter_free(CCVertIterator *vi) { _ehashIterator_free((EHashIterator*) vi); } -CCGEdge *ccgEdgeIterator_getCurrent(CCGEdgeIterator *vi) { - return (CCGEdge*) _ehashIterator_getCurrent((EHashIterator*) vi); +CCEdge *CCEIter_getCurrent(CCEdgeIterator *vi) { + return (CCEdge*) _ehashIterator_getCurrent((EHashIterator*) vi); } -int ccgEdgeIterator_isStopped(CCGEdgeIterator *vi) { +int CCEIter_isStopped(CCEdgeIterator *vi) { return _ehashIterator_isStopped((EHashIterator*) vi); } -void ccgEdgeIterator_next(CCGEdgeIterator *vi) { +void CCEIter_next(CCEdgeIterator *vi) { _ehashIterator_next((EHashIterator*) vi); } -void ccgEdgeIterator_free(CCGEdgeIterator *vi) { +void CCEIter_free(CCEdgeIterator *vi) { _ehashIterator_free((EHashIterator*) vi); } -CCGFace *ccgFaceIterator_getCurrent(CCGFaceIterator *vi) { - return (CCGFace*) _ehashIterator_getCurrent((EHashIterator*) vi); +CCFace *CCFIter_getCurrent(CCFaceIterator *vi) { + return (CCFace*) _ehashIterator_getCurrent((EHashIterator*) vi); } -int ccgFaceIterator_isStopped(CCGFaceIterator *vi) { +int CCFIter_isStopped(CCFaceIterator *vi) { return _ehashIterator_isStopped((EHashIterator*) vi); } -void ccgFaceIterator_next(CCGFaceIterator *vi) { +void CCFIter_next(CCFaceIterator *vi) { _ehashIterator_next((EHashIterator*) vi); } -void ccgFaceIterator_free(CCGFaceIterator *vi) { +void CCFIter_free(CCFaceIterator *vi) { _ehashIterator_free((EHashIterator*) vi); } /*** Extern API final vert/edge/face interface ***/ -int ccgSubSurf_getNumFinalVerts(CCGSubSurf *ss) { +int CCS_getNumFinalVerts(CSubSurf *ss) { int edgeSize = 1 + (1<<ss->subdivLevels); int gridSize = 1 + (1<<(ss->subdivLevels-1)); int numFinalVerts = ss->vMap->numEntries + ss->eMap->numEntries*(edgeSize-2) + ss->fMap->numEntries + ss->numGrids*((gridSize-2) + ((gridSize-2)*(gridSize-2))); return numFinalVerts; } -int ccgSubSurf_getNumFinalEdges(CCGSubSurf *ss) { +int CCS_getNumFinalEdges(CSubSurf *ss) { int edgeSize = 1 + (1<<ss->subdivLevels); int gridSize = 1 + (1<<(ss->subdivLevels-1)); int numFinalEdges = ss->eMap->numEntries*(edgeSize-1) + ss->numGrids*((gridSize-1) + 2*((gridSize-2)*(gridSize-1))); return numFinalEdges; } -int ccgSubSurf_getNumFinalFaces(CCGSubSurf *ss) { +int CCS_getNumFinalFaces(CSubSurf *ss) { int gridSize = 1 + (1<<(ss->subdivLevels-1)); int numFinalFaces = ss->numGrids*((gridSize-1)*(gridSize-1)); return numFinalFaces; diff --git a/source/blender/blenkernel/intern/CCGSubSurf.h b/source/blender/blenkernel/intern/CCGSubSurf.h index c7716314899..2d4bef3d038 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf.h +++ b/source/blender/blenkernel/intern/CCGSubSurf.h @@ -1,31 +1,30 @@ /* $Id$ */ typedef void* CCGMeshHDL; -typedef void* CCGVertHDL; -typedef void* CCGEdgeHDL; -typedef void* CCGFaceHDL; +typedef void* CCVertHDL; +typedef void* CCEdgeHDL; +typedef void* CCFaceHDL; -typedef struct _CCGVert CCGVert; -typedef struct _CCGEdge CCGEdge; -typedef struct _CCGFace CCGFace; +typedef struct _CCVert CCVert; +typedef struct _CCEdge CCEdge; +typedef struct _CCFace CCFace; typedef struct _CCGMeshIFC CCGMeshIFC; struct _CCGMeshIFC { - int vertUserSize, edgeUserSize, faceUserSize; - - int vertDataSize; + int vertUserSize, edgeUserSize, faceUserSize; + int vertDataSize; }; /***/ -typedef void* CCGAllocatorHDL; +typedef void* CCAllocHDL; typedef struct _CCGAllocatorIFC CCGAllocatorIFC; struct _CCGAllocatorIFC { - void* (*alloc) (CCGAllocatorHDL a, int numBytes); - void* (*realloc) (CCGAllocatorHDL a, void *ptr, int newSize, int oldSize); - void (*free) (CCGAllocatorHDL a, void *ptr); - void (*release) (CCGAllocatorHDL a); + void* (*alloc) (CCAllocHDL a, int numBytes); + void* (*realloc) (CCAllocHDL a, void *ptr, int newSize, int oldSize); + void (*free) (CCAllocHDL a, void *ptr); + void (*release) (CCAllocHDL a); }; /***/ @@ -39,114 +38,114 @@ typedef enum { /***/ -typedef struct _CCGSubSurf CCGSubSurf; +typedef struct _CSubSurf CSubSurf; -CCGSubSurf* ccgSubSurf_new (CCGMeshIFC *ifc, int subdivisionLevels, CCGAllocatorIFC *allocatorIFC, CCGAllocatorHDL allocator); -void ccgSubSurf_free (CCGSubSurf *ss); +CSubSurf* CCS_new (CCGMeshIFC *ifc, int subdivisionLevels, CCGAllocatorIFC *allocatorIFC, CCAllocHDL allocator); +void CCS_free (CSubSurf *ss); -CCGError ccgSubSurf_sync (CCGSubSurf *ss); +CCGError CCS_sync (CSubSurf *ss); -CCGError ccgSubSurf_initFullSync (CCGSubSurf *ss); -CCGError ccgSubSurf_initPartialSync (CCGSubSurf *ss); +CCGError CCS_initFullSync (CSubSurf *ss); +CCGError CCS_initPartialSync (CSubSurf *ss); -CCGError ccgSubSurf_syncVert (CCGSubSurf *ss, CCGVertHDL vHDL, void *vertData, int seam, CCGVert **v_r); -CCGError ccgSubSurf_syncEdge (CCGSubSurf *ss, CCGEdgeHDL eHDL, CCGVertHDL e_vHDL0, CCGVertHDL e_vHDL1, float crease, CCGEdge **e_r); -CCGError ccgSubSurf_syncFace (CCGSubSurf *ss, CCGFaceHDL fHDL, int numVerts, CCGVertHDL *vHDLs, CCGFace **f_r); +CCGError CCS_syncVert (CSubSurf *ss, CCVertHDL vHDL, void *vertData, int seam, CCVert **v_r); +CCGError CCS_syncEdge (CSubSurf *ss, CCEdgeHDL eHDL, CCVertHDL e_vHDL0, CCVertHDL e_vHDL1, float crease, CCEdge **e_r); +CCGError CCS_syncFace (CSubSurf *ss, CCFaceHDL fHDL, int numVerts, CCVertHDL *vHDLs, CCFace **f_r); -CCGError ccgSubSurf_syncVertDel (CCGSubSurf *ss, CCGVertHDL vHDL); -CCGError ccgSubSurf_syncEdgeDel (CCGSubSurf *ss, CCGEdgeHDL eHDL); -CCGError ccgSubSurf_syncFaceDel (CCGSubSurf *ss, CCGFaceHDL fHDL); +CCGError CCS_syncVertDel (CSubSurf *ss, CCVertHDL vHDL); +CCGError CCS_syncEdgeDel (CSubSurf *ss, CCEdgeHDL eHDL); +CCGError CCS_syncFaceDel (CSubSurf *ss, CCFaceHDL fHDL); -CCGError ccgSubSurf_processSync (CCGSubSurf *ss); +CCGError CCS_processSync (CSubSurf *ss); -CCGError ccgSubSurf_setSubdivisionLevels (CCGSubSurf *ss, int subdivisionLevels); +CCGError CCS_setSubdivisionLevels(CSubSurf *ss, int subdivisionLevels); -CCGError ccgSubSurf_setAllowEdgeCreation (CCGSubSurf *ss, int allowEdgeCreation, float defaultCreaseValue, void *defaultUserData); -void ccgSubSurf_getAllowEdgeCreation (CCGSubSurf *ss, int *allowEdgeCreation_r, float *defaultCreaseValue_r, void *defaultUserData_r); +CCGError CCS_setAllowEdgeCreation(CSubSurf *ss, int allowEdgeCreation, float defaultCreaseValue, void *defaultUserData); +void CCS_getAllowEdgeCreation(CSubSurf *ss, int *allowEdgeCreation_r, float *defaultCreaseValue_r, void *defaultUserData_r); -void ccgSubSurf_getUseAgeCounts (CCGSubSurf *ss, int *useAgeCounts_r, int *vertUserOffset_r, int *edgeUserOffset_r, int *faceUserOffset_r); -CCGError ccgSubSurf_setUseAgeCounts (CCGSubSurf *ss, int useAgeCounts, int vertUserOffset, int edgeUserOffset, int faceUserOffset); +void CCS_getUseAgeCounts (CSubSurf *ss, int *useAgeCounts_r, int *vertUserOffset_r, int *edgeUserOffset_r, int *faceUserOffset_r); +CCGError CCS_setUseAgeCounts (CSubSurf *ss, int useAgeCounts, int vertUserOffset, int edgeUserOffset, int faceUserOffset); -CCGError ccgSubSurf_setCalcVertexNormals (CCGSubSurf *ss, int useVertNormals, int normalDataOffset); +CCGError CCS_setCalcVertexNormals(CSubSurf *ss, int useVertNormals, int normalDataOffset); /***/ -int ccgSubSurf_getNumVerts (CCGSubSurf *ss); -int ccgSubSurf_getNumEdges (CCGSubSurf *ss); -int ccgSubSurf_getNumTessFaces (CCGSubSurf *ss); - -int ccgSubSurf_getSubdivisionLevels (CCGSubSurf *ss); -int ccgSubSurf_getEdgeSize (CCGSubSurf *ss); -int ccgSubSurf_getEdgeLevelSize (CCGSubSurf *ss, int level); -int ccgSubSurf_getGridSize (CCGSubSurf *ss); -int ccgSubSurf_getGridLevelSize (CCGSubSurf *ss, int level); - -CCGVert* ccgSubSurf_getVert (CCGSubSurf *ss, CCGVertHDL v); -CCGVertHDL ccgSubSurf_getVertVertHandle (CCGVert *v); -int ccgSubSurf_getVertNumFaces (CCGVert *v); -CCGFace* ccgSubSurf_getVertFace (CCGVert *v, int index); -int ccgSubSurf_getVertNumEdges (CCGVert *v); -CCGEdge* ccgSubSurf_getVertEdge (CCGVert *v, int index); - -int ccgSubSurf_getVertAge (CCGSubSurf *ss, CCGVert *v); -void* ccgSubSurf_getVertUserData (CCGSubSurf *ss, CCGVert *v); -void* ccgSubSurf_getVertData (CCGSubSurf *ss, CCGVert *v); -void* ccgSubSurf_getVertLevelData (CCGSubSurf *ss, CCGVert *v, int level); - -CCGEdge* ccgSubSurf_getEdge (CCGSubSurf *ss, CCGEdgeHDL e); -CCGEdgeHDL ccgSubSurf_getEdgeEdgeHandle (CCGEdge *e); -int ccgSubSurf_getEdgeNumFaces (CCGEdge *e); -CCGFace* ccgSubSurf_getEdgeFace (CCGEdge *e, int index); -CCGVert* ccgSubSurf_getEdgeVert0 (CCGEdge *e); -CCGVert* ccgSubSurf_getEdgeVert1 (CCGEdge *e); -float ccgSubSurf_getEdgeCrease (CCGEdge *e); - -int ccgSubSurf_getEdgeAge (CCGSubSurf *ss, CCGEdge *e); -void* ccgSubSurf_getEdgeUserData (CCGSubSurf *ss, CCGEdge *e); -void* ccgSubSurf_getEdgeDataArray (CCGSubSurf *ss, CCGEdge *e); -void* ccgSubSurf_getEdgeData (CCGSubSurf *ss, CCGEdge *e, int x); -void* ccgSubSurf_getEdgeLevelData (CCGSubSurf *ss, CCGEdge *e, int x, int level); - -CCGFace* ccgSubSurf_getFace (CCGSubSurf *ss, CCGFaceHDL f); -CCGFaceHDL ccgSubSurf_getFaceFaceHandle (CCGSubSurf *ss, CCGFace *f); -int ccgSubSurf_getFaceNumVerts (CCGFace *f); -CCGVert* ccgSubSurf_getFaceVert (CCGSubSurf *ss, CCGFace *f, int index); -CCGEdge* ccgSubSurf_getFaceEdge (CCGSubSurf *ss, CCGFace *f, int index); -int ccgSubSurf_getFaceEdgeIndex (CCGFace *f, CCGEdge *e); - -int ccgSubSurf_getFaceAge (CCGSubSurf *ss, CCGFace *f); -void* ccgSubSurf_getFaceUserData (CCGSubSurf *ss, CCGFace *f); -void* ccgSubSurf_getFaceCenterData (CCGFace *f); -void* ccgSubSurf_getFaceGridEdgeDataArray (CCGSubSurf *ss, CCGFace *f, int gridIndex); -void* ccgSubSurf_getFaceGridEdgeData (CCGSubSurf *ss, CCGFace *f, int gridIndex, int x); -void* ccgSubSurf_getFaceGridDataArray (CCGSubSurf *ss, CCGFace *f, int gridIndex); -void* ccgSubSurf_getFaceGridData (CCGSubSurf *ss, CCGFace *f, int gridIndex, int x, int y); - -int ccgSubSurf_getNumFinalVerts (CCGSubSurf *ss); -int ccgSubSurf_getNumFinalEdges (CCGSubSurf *ss); -int ccgSubSurf_getNumFinalFaces (CCGSubSurf *ss); +int CCS_getNumVerts (CSubSurf *ss); +int CCS_getNumEdges (CSubSurf *ss); +int CCS_getNumFaces (CSubSurf *ss); + +int CCS_getSubdivisionLevels(CSubSurf *ss); +int CCS_getEdgeSize (CSubSurf *ss); +int CCS_getEdgeLevelSize (CSubSurf *ss, int level); +int CCS_getGridSize (CSubSurf *ss); +int CCS_getGridLevelSize (CSubSurf *ss, int level); + +CCVert* CCS_getVert (CSubSurf *ss, CCVertHDL v); +CCVertHDL CCS_getVertVertHandle (CCVert *v); +int CCS_getVertNumFaces (CCVert *v); +CCFace* CCS_getVertFace (CCVert *v, int index); +int CCS_getVertNumEdges (CCVert *v); +CCEdge* CCS_getVertEdge (CCVert *v, int index); + +int CCS_getVertAge (CSubSurf *ss, CCVert *v); +void* CCS_getVertUserData (CSubSurf *ss, CCVert *v); +void* CCS_getVertData (CSubSurf *ss, CCVert *v); +void* CCS_getVertLevelData (CSubSurf *ss, CCVert *v, int level); + +CCEdge* CCS_getEdge (CSubSurf *ss, CCEdgeHDL e); +CCEdgeHDL CCS_getEdgeEdgeHandle (CCEdge *e); +int CCS_getEdgeNumFaces (CCEdge *e); +CCFace* CCS_getEdgeFace (CCEdge *e, int index); +CCVert* CCS_getEdgeVert0 (CCEdge *e); +CCVert* CCS_getEdgeVert1 (CCEdge *e); +float CCS_getEdgeCrease (CCEdge *e); + +int CCS_getEdgeAge (CSubSurf *ss, CCEdge *e); +void* CCS_getEdgeUserData (CSubSurf *ss, CCEdge *e); +void* CCS_getEdgeDataArray (CSubSurf *ss, CCEdge *e); +void* CCS_getEdgeData (CSubSurf *ss, CCEdge *e, int x); +void* CCS_getEdgeLevelData (CSubSurf *ss, CCEdge *e, int x, int level); + +CCFace* CCS_getFace (CSubSurf *ss, CCFaceHDL f); +CCFaceHDL CCS_getFaceFaceHandle (CSubSurf *ss, CCFace *f); +int CCS_getFaceNumVerts (CCFace *f); +CCVert* CCS_getFaceVert (CSubSurf *ss, CCFace *f, int index); +CCEdge* CCS_getFaceEdge (CSubSurf *ss, CCFace *f, int index); +int CCS_getFaceEdgeIndex (CCFace *f, CCEdge *e); + +int CCS_getFaceAge (CSubSurf *ss, CCFace *f); +void* CCS_getFaceUserData (CSubSurf *ss, CCFace *f); +void* CCS_getFaceCenterData (CCFace *f); +void* CCS_getFaceGridEdgeDataArray (CSubSurf *ss, CCFace *f, int gridIndex); +void* CCS_getFaceGridEdgeData (CSubSurf *ss, CCFace *f, int gridIndex, int x); +void* CCS_getFaceGridDataArray (CSubSurf *ss, CCFace *f, int gridIndex); +void* CCS_getFaceGridData (CSubSurf *ss, CCFace *f, int gridIndex, int x, int y); + +int CCS_getNumFinalVerts (CSubSurf *ss); +int CCS_getNumFinalEdges (CSubSurf *ss); +int CCS_getNumFinalFaces (CSubSurf *ss); /***/ -typedef struct _CCGVertIterator CCGVertIterator; -typedef struct _CCGEdgeIterator CCGEdgeIterator; -typedef struct _CCGFaceIterator CCGFaceIterator; +typedef struct _CCVertIterator CCVertIterator; +typedef struct _CCEdgeIterator CCEdgeIterator; +typedef struct _CCFaceIterator CCFaceIterator; -CCGVertIterator* ccgSubSurf_getVertIterator (CCGSubSurf *ss); -CCGEdgeIterator* ccgSubSurf_getEdgeIterator (CCGSubSurf *ss); -CCGFaceIterator* ccgSubSurf_getFaceIterator (CCGSubSurf *ss); +CCVertIterator* CCS_getVertIterator (CSubSurf *ss); +CCEdgeIterator* CCS_getEdgeIterator (CSubSurf *ss); +CCFaceIterator* CCS_getFaceIterator (CSubSurf *ss); -CCGVert* ccgVertIterator_getCurrent (CCGVertIterator *vi); -int ccgVertIterator_isStopped (CCGVertIterator *vi); -void ccgVertIterator_next (CCGVertIterator *vi); -void ccgVertIterator_free (CCGVertIterator *vi); +CCVert* CCVIter_getCurrent (CCVertIterator *vi); +int CCVIter_isStopped (CCVertIterator *vi); +void CCVIter_next (CCVertIterator *vi); +void CCVIter_free (CCVertIterator *vi); -CCGEdge* ccgEdgeIterator_getCurrent (CCGEdgeIterator *ei); -int ccgEdgeIterator_isStopped (CCGEdgeIterator *ei); -void ccgEdgeIterator_next (CCGEdgeIterator *ei); -void ccgEdgeIterator_free (CCGEdgeIterator *ei); +CCEdge* CCEIter_getCurrent (CCEdgeIterator *ei); +int CCEIter_isStopped (CCEdgeIterator *ei); +void CCEIter_next (CCEdgeIterator *ei); +void CCEIter_free (CCEdgeIterator *ei); -CCGFace* ccgFaceIterator_getCurrent (CCGFaceIterator *fi); -int ccgFaceIterator_isStopped (CCGFaceIterator *fi); -void ccgFaceIterator_next (CCGFaceIterator *fi); -void ccgFaceIterator_free (CCGFaceIterator *fi); +CCFace* CCFIter_getCurrent (CCFaceIterator *fi); +int CCFIter_isStopped (CCFaceIterator *fi); +void CCFIter_next (CCFaceIterator *fi); +void CCFIter_free (CCFaceIterator *fi); diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index a1068080927..a4c7eaac5cc 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -209,7 +209,7 @@ void DM_init_funcs(DerivedMesh *dm) dm->getTessFaceData = DM_get_face_data; dm->getVertDataArray = DM_get_vert_data_layer; dm->getEdgeDataArray = DM_get_edge_data_layer; - dm->getTessFaceDataArray = DM_get_face_data_layer; + dm->getTessFaceDataArray = DM_get_tessface_data_layer; bvhcache_init(&dm->bvhCache); } @@ -417,11 +417,21 @@ void DM_add_edge_layer(DerivedMesh *dm, int type, int alloctype, void *layer) CustomData_add_layer(&dm->edgeData, type, alloctype, layer, dm->numEdgeData); } -void DM_add_face_layer(DerivedMesh *dm, int type, int alloctype, void *layer) +void DM_add_tessface_layer(DerivedMesh *dm, int type, int alloctype, void *layer) { CustomData_add_layer(&dm->faceData, type, alloctype, layer, dm->numFaceData); } +void DM_add_loop_layer(DerivedMesh *dm, int type, int alloctype, void *layer) +{ + CustomData_add_layer(&dm->loopData, type, alloctype, layer, dm->numLoopData); +} + +void DM_add_face_layer(DerivedMesh *dm, int type, int alloctype, void *layer) +{ + CustomData_add_layer(&dm->polyData, type, alloctype, layer, dm->numPolyData); +} + void *DM_get_vert_data(DerivedMesh *dm, int index, int type) { return CustomData_get(&dm->vertData, index, type); @@ -447,11 +457,16 @@ void *DM_get_edge_data_layer(DerivedMesh *dm, int type) return CustomData_get_layer(&dm->edgeData, type); } -void *DM_get_face_data_layer(DerivedMesh *dm, int type) +void *DM_get_tessface_data_layer(DerivedMesh *dm, int type) { return CustomData_get_layer(&dm->faceData, type); } +void *DM_get_face_data_layer(DerivedMesh *dm, int type) +{ + return CustomData_get_layer(&dm->polyData, type); +} + void DM_set_vert_data(DerivedMesh *dm, int index, int type, void *data) { CustomData_set(&dm->vertData, index, type, data); @@ -1410,7 +1425,7 @@ static void *emDM_getFaceDataArray(void *dm, int type) void *datalayer; int index, offset, size; - datalayer = DM_get_face_data_layer(dm, type); + datalayer = DM_get_tessface_data_layer(dm, type); if(datalayer) return datalayer; @@ -1423,11 +1438,11 @@ static void *emDM_getFaceDataArray(void *dm, int type) offset = em->fdata.layers[index].offset; size = CustomData_sizeof(type); - DM_add_face_layer(dm, type, CD_CALLOC, NULL); + DM_add_tessface_layer(dm, type, CD_CALLOC, NULL); index = CustomData_get_layer_index(&emdm->dm.faceData, type); emdm->dm.faceData.layers[index].flag |= CD_FLAG_TEMPORARY; - data = datalayer = DM_get_face_data_layer(dm, type); + data = datalayer = DM_get_tessface_data_layer(dm, type); for(efa=em->faces.first; efa; efa=efa->next, data+=size) { emdata = CustomData_em_get(&em->fdata, efa->data, type); memcpy(data, emdata, size); @@ -1931,7 +1946,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos /* add an origspace layer if needed */ if(((CustomDataMask)GET_INT_FROM_POINTER(curr->link)) & CD_MASK_ORIGSPACE) if(!CustomData_has_layer(&dm->faceData, CD_ORIGSPACE)) - DM_add_face_layer(dm, CD_ORIGSPACE, CD_DEFAULT, NULL); + DM_add_tessface_layer(dm, CD_ORIGSPACE, CD_DEFAULT, NULL); ndm = mti->applyModifier(md, ob, dm, useRenderParams, !inputVertexCos); @@ -2150,7 +2165,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D if(((CustomDataMask)GET_INT_FROM_POINTER(curr->link)) & CD_MASK_ORIGSPACE) if(!CustomData_has_layer(&dm->faceData, CD_ORIGSPACE)) - DM_add_face_layer(dm, CD_ORIGSPACE, CD_DEFAULT, NULL); + DM_add_tessface_layer(dm, CD_ORIGSPACE, CD_DEFAULT, NULL); ndm = mti->applyModifierEM(md, ob, em, dm); @@ -2571,8 +2586,8 @@ void DM_add_tangent_layer(DerivedMesh *dm) } /* create tangent layer */ - DM_add_face_layer(dm, CD_TANGENT, CD_CALLOC, NULL); - tangent= DM_get_face_data_layer(dm, CD_TANGENT); + DM_add_tessface_layer(dm, CD_TANGENT, CD_CALLOC, NULL); + tangent= DM_get_tessface_data_layer(dm, CD_TANGENT); /* allocate some space */ arena= BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index c1e412458ee..61355c4265e 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -196,7 +196,7 @@ static void cdDM_drawUVEdges(DerivedMesh *dm) { CDDerivedMesh *cddm = (CDDerivedMesh*) dm; MFace *mf = cddm->mface; - MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE); + MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE); int i; if(mf) { @@ -403,8 +403,8 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, MFace *mf = cddm->mface; MCol *mcol = dm->getTessFaceDataArray(dm, CD_MCOL); float *nors= dm->getTessFaceDataArray(dm, CD_NORMAL); - MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE); - int i, orig, *index = DM_get_face_data_layer(dm, CD_ORIGINDEX); + MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE); + int i, orig, *index = DM_get_tessface_data_layer(dm, CD_ORIGINDEX); for(i = 0; i < dm->numFaceData; i++, mf++) { MVert *mvert; @@ -494,11 +494,11 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us MFace *mf = cddm->mface; MCol *mc; float *nors= dm->getTessFaceDataArray(dm, CD_NORMAL); - int i, orig, *index = DM_get_face_data_layer(dm, CD_ORIGINDEX); + int i, orig, *index = DM_get_tessface_data_layer(dm, CD_ORIGINDEX); - mc = DM_get_face_data_layer(dm, CD_WEIGHT_MCOL); + mc = DM_get_tessface_data_layer(dm, CD_WEIGHT_MCOL); if(!mc) - mc = DM_get_face_data_layer(dm, CD_MCOL); + mc = DM_get_tessface_data_layer(dm, CD_MCOL); for(i = 0; i < dm->numFaceData; i++, mf++) { int drawSmooth = (mf->flag & ME_SMOOTH); @@ -857,7 +857,7 @@ static CDDerivedMesh *cdDM_create(const char *desc) dm->getTessFaceData = DM_get_face_data; dm->getVertDataArray = DM_get_vert_data_layer; dm->getEdgeDataArray = DM_get_edge_data_layer; - dm->getTessFaceDataArray = DM_get_face_data_layer; + dm->getTessFaceDataArray = DM_get_tessface_data_layer; dm->getVertCos = cdDM_getVertCos; dm->getVertCo = cdDM_getVertCo; diff --git a/source/blender/blenkernel/intern/editderivedbmesh.c b/source/blender/blenkernel/intern/editderivedbmesh.c index 1d60386bb2f..c34f5253a42 100644 --- a/source/blender/blenkernel/intern/editderivedbmesh.c +++ b/source/blender/blenkernel/intern/editderivedbmesh.c @@ -1252,7 +1252,7 @@ static void *bmDM_getFaceDataArray(DerivedMesh *dm, int type) void *datalayer; int index, offset, size, i; - datalayer = DM_get_face_data_layer(dm, type); + datalayer = DM_get_tessface_data_layer(dm, type); if(datalayer) return datalayer; @@ -1265,11 +1265,11 @@ static void *bmDM_getFaceDataArray(DerivedMesh *dm, int type) offset = bm->pdata.layers[index].offset; size = CustomData_sizeof(type); - DM_add_face_layer(dm, type, CD_CALLOC, NULL); + DM_add_tessface_layer(dm, type, CD_CALLOC, NULL); index = CustomData_get_layer_index(&dm->faceData, type); dm->faceData.layers[index].flag |= CD_FLAG_TEMPORARY; - data = datalayer = DM_get_face_data_layer(dm, type); + data = datalayer = DM_get_tessface_data_layer(dm, type); for (i=0; i<bmdm->tc->tottri; i++, data+=size) { efa = bmdm->tc->looptris[i][0]->f; /*BMESH_TODO: need to still add tface data, diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c index 2149632d189..03c6942a318 100644 --- a/source/blender/blenkernel/intern/modifier.c +++ b/source/blender/blenkernel/intern/modifier.c @@ -399,10 +399,10 @@ static void subsurfModifier_freeData(ModifierData *md) SubsurfModifierData *smd = (SubsurfModifierData*) md; if(smd->mCache) { - ccgSubSurf_free(smd->mCache); + CCS_free(smd->mCache); } if(smd->emCache) { - ccgSubSurf_free(smd->emCache); + CCS_free(smd->emCache); } } diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 873d4fa00be..72a6bc3b862 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -302,7 +302,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm, ParticleSystem *psys) else { /* FROM_FACE/FROM_VOLUME */ totdmelem= dm->getNumTessFaces(dm); totelem= me->totface; - origindex= DM_get_face_data_layer(dm, CD_ORIGINDEX); + origindex= DM_get_tessface_data_layer(dm, CD_ORIGINDEX); } nodedmelem= MEM_callocN(sizeof(LinkNode)*totdmelem, "psys node elems"); diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 624f6b51718..e9f07fcdb20 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -77,42 +77,42 @@ typedef struct _VertData { struct CCGDerivedMesh { DerivedMesh dm; - CCGSubSurf *ss; + CSubSurf *ss; int drawInteriorEdges, useSubsurfUv; - struct {int startVert; CCGVert *vert;} *vertMap; - struct {int startVert; int startEdge; CCGEdge *edge;} *edgeMap; + struct {int startVert; CCVert *vert;} *vertMap; + struct {int startVert; int startEdge; CCEdge *edge;} *edgeMap; struct {int startVert; int startEdge; - int startFace; CCGFace *face;} *faceMap; + int startFace; CCFace *face;} *faceMap; }; typedef struct CCGDerivedMesh CCGDerivedMesh; -static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v); -static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e); -static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f); +static int cgdm_getVertMapIndex(CSubSurf *ss, CCVert *v); +static int cgdm_getEdgeMapIndex(CSubSurf *ss, CCEdge *e); +static int cgdm_getFaceMapIndex(CSubSurf *ss, CCFace *f); /// -static void *arena_alloc(CCGAllocatorHDL a, int numBytes) { +static void *arena_alloc(CCAllocHDL a, int numBytes) { return BLI_memarena_alloc(a, numBytes); } -static void *arena_realloc(CCGAllocatorHDL a, void *ptr, int newSize, int oldSize) { +static void *arena_realloc(CCAllocHDL a, void *ptr, int newSize, int oldSize) { void *p2 = BLI_memarena_alloc(a, newSize); if (ptr) { memcpy(p2, ptr, oldSize); } return p2; } -static void arena_free(CCGAllocatorHDL a, void *ptr) { +static void arena_free(CCAllocHDL a, void *ptr) { } -static void arena_release(CCGAllocatorHDL a) { +static void arena_release(CCAllocHDL a) { BLI_memarena_free(a); } -static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAging, int useArena, int useFlatSubdiv) { +static CSubSurf *_getSubSurf(CSubSurf *prevSS, int subdivLevels, int useAging, int useArena, int useFlatSubdiv) { CCGMeshIFC ifc; - CCGSubSurf *ccgSS; + CSubSurf *ccgSS; /* subdivLevels==0 is not allowed */ subdivLevels = MAX2(subdivLevels, 1); @@ -121,12 +121,12 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAgin int oldUseAging; useAging = !!useAging; - ccgSubSurf_getUseAgeCounts(prevSS, &oldUseAging, NULL, NULL, NULL); + CCS_getUseAgeCounts(prevSS, &oldUseAging, NULL, NULL, NULL); if (oldUseAging!=useAging) { - ccgSubSurf_free(prevSS); + CCS_free(prevSS); } else { - ccgSubSurf_setSubdivisionLevels(prevSS, subdivLevels); + CCS_setSubdivisionLevels(prevSS, subdivLevels); return prevSS; } @@ -141,33 +141,33 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAgin if (useArena) { CCGAllocatorIFC allocatorIFC; - CCGAllocatorHDL allocator = BLI_memarena_new((1<<16)); + CCAllocHDL allocator = BLI_memarena_new((1<<16)); allocatorIFC.alloc = arena_alloc; allocatorIFC.realloc = arena_realloc; allocatorIFC.free = arena_free; allocatorIFC.release = arena_release; - ccgSS = ccgSubSurf_new(&ifc, subdivLevels, &allocatorIFC, allocator); + ccgSS = CCS_new(&ifc, subdivLevels, &allocatorIFC, allocator); } else { - ccgSS = ccgSubSurf_new(&ifc, subdivLevels, NULL, NULL); + ccgSS = CCS_new(&ifc, subdivLevels, NULL, NULL); } if (useAging) { - ccgSubSurf_setUseAgeCounts(ccgSS, 1, 8, 8, 8); + CCS_setUseAgeCounts(ccgSS, 1, 8, 8, 8); } - ccgSubSurf_setCalcVertexNormals(ccgSS, 1, BLI_STRUCT_OFFSET(VertData, no)); + CCS_setCalcVertexNormals(ccgSS, 1, BLI_STRUCT_OFFSET(VertData, no)); return ccgSS; } -static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize) { - CCGVert *v0 = ccgSubSurf_getEdgeVert0(e); - CCGVert *v1 = ccgSubSurf_getEdgeVert1(e); - int v0idx = *((int*) ccgSubSurf_getVertUserData(ss, v0)); - int v1idx = *((int*) ccgSubSurf_getVertUserData(ss, v1)); - int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e)); +static int getEdgeIndex(CSubSurf *ss, CCEdge *e, int x, int edgeSize) { + CCVert *v0 = CCS_getEdgeVert0(e); + CCVert *v1 = CCS_getEdgeVert1(e); + int v0idx = *((int*) CCS_getVertUserData(ss, v0)); + int v1idx = *((int*) CCS_getVertUserData(ss, v1)); + int edgeBase = *((int*) CCS_getEdgeUserData(ss, e)); if (x==0) { return v0idx; @@ -177,27 +177,27 @@ static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize) { return edgeBase + x-1; } } -static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edgeSize, int gridSize) { - int faceBase = *((int*) ccgSubSurf_getFaceUserData(ss, f)); - int numVerts = ccgSubSurf_getFaceNumVerts(f); +static int getFaceIndex(CSubSurf *ss, CCFace *f, int S, int x, int y, int edgeSize, int gridSize) { + int faceBase = *((int*) CCS_getFaceUserData(ss, f)); + int numVerts = CCS_getFaceNumVerts(f); if (x==gridSize-1 && y==gridSize-1) { - CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S); - return *((int*) ccgSubSurf_getVertUserData(ss, v)); + CCVert *v = CCS_getFaceVert(ss, f, S); + return *((int*) CCS_getVertUserData(ss, v)); } else if (x==gridSize-1) { - CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S); - CCGEdge *e = ccgSubSurf_getFaceEdge(ss, f, S); - int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e)); - if (v==ccgSubSurf_getEdgeVert0(e)) { + CCVert *v = CCS_getFaceVert(ss, f, S); + CCEdge *e = CCS_getFaceEdge(ss, f, S); + int edgeBase = *((int*) CCS_getEdgeUserData(ss, e)); + if (v==CCS_getEdgeVert0(e)) { return edgeBase + (gridSize-1-y)-1; } else { return edgeBase + (edgeSize-2-1)-((gridSize-1-y)-1); } } else if (y==gridSize-1) { - CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S); - CCGEdge *e = ccgSubSurf_getFaceEdge(ss, f, (S+numVerts-1)%numVerts); - int edgeBase = *((int*) ccgSubSurf_getEdgeUserData(ss, e)); - if (v==ccgSubSurf_getEdgeVert0(e)) { + CCVert *v = CCS_getFaceVert(ss, f, S); + CCEdge *e = CCS_getFaceEdge(ss, f, (S+numVerts-1)%numVerts); + int edgeBase = *((int*) CCS_getEdgeUserData(ss, e)); + if (v==CCS_getEdgeVert0(e)) { return edgeBase + (gridSize-1-x)-1; } else { return edgeBase + (edgeSize-2-1)-((gridSize-1-x)-1); @@ -214,7 +214,7 @@ static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edg } } -static void get_face_uv_map_vert(UvVertMap *vmap, struct MFace *mf, int fi, CCGVertHDL *fverts) { +static void get_face_uv_map_vert(UvVertMap *vmap, struct MFace *mf, int fi, CCVertHDL *fverts) { unsigned int *fv = &mf->v1; UvMapVert *v, *nv; int j, nverts= mf->v4? 4: 3; @@ -231,7 +231,7 @@ static void get_face_uv_map_vert(UvVertMap *vmap, struct MFace *mf, int fi, CCGV } } -static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, MTFace *tface) { +static int ss_sync_from_uv(CSubSurf *ss, CSubSurf *origss, DerivedMesh *dm, MTFace *tface) { #if 0 MFace *mface = dm->getTessFaceArray(dm); MVert *mvert = dm->getVertArray(dm); @@ -241,16 +241,16 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, UvMapVert *v; UvVertMap *vmap; float limit[2]; - CCGVertHDL fverts[4]; + CCVertHDL fverts[4]; EdgeHash *ehash; - float creaseFactor = (float)ccgSubSurf_getSubdivisionLevels(ss); + float creaseFactor = (float)CCS_getSubdivisionLevels(ss); limit[0]= limit[1]= STD_UV_CONNECT_LIMIT; vmap= make_uv_vert_map(mface, tface, totface, totvert, 0, limit); if (!vmap) return 0; - ccgSubSurf_initFullSync(ss); + CCS_initFullSync(ss); /* create vertices */ for (i=0; i<totvert; i++) { @@ -265,15 +265,15 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, for (v=get_uv_map_vert(vmap, i); v; v=v->next) { if (v->separate) { - CCGVert *ssv; - CCGVertHDL vhdl = SET_INT_IN_POINTER(v->f*4 + v->tfindex); + CCVert *ssv; + CCVertHDL vhdl = SET_INT_IN_POINTER(v->f*4 + v->tfindex); float uv[3]; uv[0]= (tface+v->f)->uv[v->tfindex][0]; uv[1]= (tface+v->f)->uv[v->tfindex][1]; uv[2]= 0.0f; - ccgSubSurf_syncVert(ss, vhdl, uv, seam, &ssv); + CCS_syncVert(ss, vhdl, uv, seam, &ssv); } } } @@ -284,7 +284,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, for (i=0; i<totface; i++) { MFace *mf = &((MFace*) mface)[i]; int nverts= mf->v4? 4: 3; - CCGFace *origf= ccgSubSurf_getFace(origss, SET_INT_IN_POINTER(i)); + CCFace *origf= CCS_getFace(origss, SET_INT_IN_POINTER(i)); unsigned int *fv = &mf->v1; get_face_uv_map_vert(vmap, mf, i, fverts); @@ -296,16 +296,16 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, MVert *mv1 = mvert + *(fv+((j+1)%nverts)); if (!BLI_edgehash_haskey(ehash, v0, v1)) { - CCGEdge *e, *orige= ccgSubSurf_getFaceEdge(origss, origf, j); - CCGEdgeHDL ehdl= SET_INT_IN_POINTER(i*4 + j); + CCEdge *e, *orige= CCS_getFaceEdge(origss, origf, j); + CCEdgeHDL ehdl= SET_INT_IN_POINTER(i*4 + j); float crease; if ((mv0->flag&mv1->flag) & ME_VERT_MERGED) crease = creaseFactor; else - crease = ccgSubSurf_getEdgeCrease(orige); + crease = CCS_getEdgeCrease(orige); - ccgSubSurf_syncEdge(ss, ehdl, fverts[j], fverts[(j+1)%nverts], crease, &e); + CCS_syncEdge(ss, ehdl, fverts[j], fverts[(j+1)%nverts], crease, &e); BLI_edgehash_insert(ehash, v0, v1, NULL); } } @@ -317,25 +317,25 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, for (i=0; i<totface; i++) { MFace *mf = &((MFace*) mface)[i]; int nverts= mf->v4? 4: 3; - CCGFace *f; + CCFace *f; get_face_uv_map_vert(vmap, mf, i, fverts); - ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), nverts, fverts, &f); + CCS_syncFace(ss, SET_INT_IN_POINTER(i), nverts, fverts, &f); } free_uv_vert_map(vmap); - ccgSubSurf_processSync(ss); + CCS_processSync(ss); #endif return 1; } -static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result, int n) +static void set_subsurf_uv(CSubSurf *ss, DerivedMesh *dm, DerivedMesh *result, int n) { - CCGSubSurf *uvss; - CCGFace **faceMap; + CSubSurf *uvss; + CCFace **faceMap; MTFace *tf; - CCGFaceIterator *fi; + CCFaceIterator *fi; int index, gridSize, gridFaces, edgeSize, totface, x, y, S; MTFace *dmtface = CustomData_get_layer_n(&dm->faceData, CD_MTFACE, n); MTFace *tface = CustomData_get_layer_n(&result->faceData, CD_MTFACE, n); @@ -344,38 +344,38 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result, return; /* create a CCGSubsurf from uv's */ - uvss = _getSubSurf(NULL, ccgSubSurf_getSubdivisionLevels(ss), 0, 1, 0); + uvss = _getSubSurf(NULL, CCS_getSubdivisionLevels(ss), 0, 1, 0); if(!ss_sync_from_uv(uvss, ss, dm, dmtface)) { - ccgSubSurf_free(uvss); + CCS_free(uvss); return; } /* get some info from CCGSubsurf */ - totface = ccgSubSurf_getNumTessFaces(uvss); - edgeSize = ccgSubSurf_getEdgeSize(uvss); - gridSize = ccgSubSurf_getGridSize(uvss); + totface = CCS_getNumFaces(uvss); + edgeSize = CCS_getEdgeSize(uvss); + gridSize = CCS_getGridSize(uvss); gridFaces = gridSize - 1; - /* make a map from original faces to CCGFaces */ + /* make a map from original faces to CCFaces */ faceMap = MEM_mallocN(totface*sizeof(*faceMap), "facemapuv"); - fi = ccgSubSurf_getFaceIterator(uvss); - for(; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); - faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(uvss, f))] = f; + fi = CCS_getFaceIterator(uvss); + for(; !CCFIter_isStopped(fi); CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); + faceMap[GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(uvss, f))] = f; } - ccgFaceIterator_free(fi); + CCFIter_free(fi); /* load coordinates from uvss into tface */ tf= tface; for(index = 0; index < totface; index++) { - CCGFace *f = faceMap[index]; - int numVerts = ccgSubSurf_getFaceNumVerts(f); + CCFace *f = faceMap[index]; + int numVerts = CCS_getFaceNumVerts(f); for (S=0; S<numVerts; S++) { - VertData *faceGridData= ccgSubSurf_getFaceGridDataArray(uvss, f, S); + VertData *faceGridData= CCS_getFaceGridDataArray(uvss, f, S); for(y = 0; y < gridFaces; y++) { for(x = 0; x < gridFaces; x++) { @@ -395,20 +395,20 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result, } } - ccgSubSurf_free(uvss); + CCS_free(uvss); MEM_freeN(faceMap); } #if 0 -static unsigned int ss_getEdgeFlags(CCGSubSurf *ss, CCGEdge *e, int ssFromEditmesh, DispListMesh *dlm, MEdge *medge, MTFace *tface) +static unsigned int ss_getEdgeFlags(CSubSurf *ss, CCEdge *e, int ssFromEditmesh, DispListMesh *dlm, MEdge *medge, MTFace *tface) { unsigned int flags = 0; - int N = ccgSubSurf_getEdgeNumFaces(e); + int N = CCS_getEdgeNumFaces(e); if (!N) flags |= ME_LOOSEEDGE; if (ssFromEditmesh) { - EditEdge *eed = ccgSubSurf_getEdgeEdgeHandle(e); + EditEdge *eed = CCS_getEdgeEdgeHandle(e); flags |= ME_EDGEDRAW|ME_EDGERENDER; if (eed->seam) { @@ -530,24 +530,24 @@ void free_ss_weights(WeightTable *wtable) } } -static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, +static DerivedMesh *ss_to_cdderivedmesh(CSubSurf *ss, int ssFromEditmesh, int drawInteriorEdges, int useSubsurfUv, DerivedMesh *dm, MultiresSubsurf *ms) { DerivedMesh *result; - int edgeSize = ccgSubSurf_getEdgeSize(ss); - int gridSize = ccgSubSurf_getGridSize(ss); + int edgeSize = CCS_getEdgeSize(ss); + int gridSize = CCS_getGridSize(ss); int gridFaces = gridSize - 1; int edgeBase, faceBase; int i, j, k, S, x, y, index; int *vertIdx = NULL; V_DECLARE(vertIdx); - CCGVertIterator *vi; - CCGEdgeIterator *ei; - CCGFaceIterator *fi; - CCGFace **faceMap2; - CCGEdge **edgeMap2; - CCGVert **vertMap2; + CCVertIterator *vi; + CCEdgeIterator *ei; + CCFaceIterator *fi; + CCFace **faceMap2; + CCEdge **edgeMap2; + CCVert **vertMap2; int totvert, totedge, totface; MVert *mvert; MEdge *med; @@ -560,49 +560,49 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, memset(&wtable, 0, sizeof(wtable)); /* vert map */ - totvert = ccgSubSurf_getNumVerts(ss); + totvert = CCS_getNumVerts(ss); vertMap2 = MEM_mallocN(totvert*sizeof(*vertMap2), "vertmap"); - vi = ccgSubSurf_getVertIterator(ss); - for(; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { - CCGVert *v = ccgVertIterator_getCurrent(vi); + vi = CCS_getVertIterator(ss); + for(; !CCVIter_isStopped(vi); CCVIter_next(vi)) { + CCVert *v = CCVIter_getCurrent(vi); - vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))] = v; + vertMap2[GET_INT_FROM_POINTER(CCS_getVertVertHandle(v))] = v; } - ccgVertIterator_free(vi); + CCVIter_free(vi); - totedge = ccgSubSurf_getNumEdges(ss); + totedge = CCS_getNumEdges(ss); edgeMap2 = MEM_mallocN(totedge*sizeof(*edgeMap2), "edgemap"); - ei = ccgSubSurf_getEdgeIterator(ss); - for(; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); + ei = CCS_getEdgeIterator(ss); + for(; !CCEIter_isStopped(ei); CCEIter_next(ei)) { + CCEdge *e = CCEIter_getCurrent(ei); - edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))] = e; + edgeMap2[GET_INT_FROM_POINTER(CCS_getEdgeEdgeHandle(e))] = e; } - totface = ccgSubSurf_getNumTessFaces(ss); + totface = CCS_getNumFaces(ss); faceMap2 = MEM_mallocN(totface*sizeof(*faceMap2), "facemap"); - fi = ccgSubSurf_getFaceIterator(ss); - for(; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); + fi = CCS_getFaceIterator(ss); + for(; !CCFIter_isStopped(fi); CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); - faceMap2[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f))] = f; + faceMap2[GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(ss, f))] = f; } - ccgFaceIterator_free(fi); + CCFIter_free(fi); if(ms) { - result = MultiresDM_new(ms, dm, ccgSubSurf_getNumFinalVerts(ss), - ccgSubSurf_getNumFinalEdges(ss), - ccgSubSurf_getNumFinalFaces(ss), 0, 0); + result = MultiresDM_new(ms, dm, CCS_getNumFinalVerts(ss), + CCS_getNumFinalEdges(ss), + CCS_getNumFinalFaces(ss), 0, 0); } else { if(dm) { - result = CDDM_from_template(dm, ccgSubSurf_getNumFinalVerts(ss), - ccgSubSurf_getNumFinalEdges(ss), - ccgSubSurf_getNumFinalFaces(ss), 0, 0); + result = CDDM_from_template(dm, CCS_getNumFinalVerts(ss), + CCS_getNumFinalEdges(ss), + CCS_getNumFinalFaces(ss), 0, 0); } else { - result = CDDM_new(ccgSubSurf_getNumFinalVerts(ss), - ccgSubSurf_getNumFinalEdges(ss), - ccgSubSurf_getNumFinalFaces(ss), 0, 0); + result = CDDM_new(CCS_getNumFinalVerts(ss), + CCS_getNumFinalEdges(ss), + CCS_getNumFinalFaces(ss), 0, 0); } } @@ -612,21 +612,21 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, origIndex = result->getVertData(result, 0, CD_ORIGINDEX); for(index = 0; index < totface; index++) { - CCGFace *f = faceMap2[index]; - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); + CCFace *f = faceMap2[index]; + int x, y, S, numVerts = CCS_getFaceNumVerts(f); FaceVertWeight *weight = get_ss_weights(&wtable, gridFaces, numVerts); V_RESET(vertIdx); for(S = 0; S < numVerts; S++) { - CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S); + CCVert *v = CCS_getFaceVert(ss, f, S); V_GROW(vertIdx); - vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + vertIdx[S] = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); } DM_interp_vert_data(dm, result, vertIdx, weight[0][0], numVerts, i); - VecCopyf(mvert->co, ccgSubSurf_getFaceCenterData(f)); + VecCopyf(mvert->co, CCS_getFaceCenterData(f)); *origIndex = ORIGINDEX_NONE; ++mvert; ++origIndex; @@ -650,7 +650,7 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, DM_interp_vert_data(dm, result, vertIdx, w, numVerts, i); VecCopyf(mvert->co, - ccgSubSurf_getFaceGridEdgeData(ss, f, S, x)); + CCS_getFaceGridEdgeData(ss, f, S, x)); *origIndex = ORIGINDEX_NONE; ++mvert; @@ -678,7 +678,7 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, DM_interp_vert_data(dm, result, vertIdx, w, numVerts, i); VecCopyf(mvert->co, - ccgSubSurf_getFaceGridData(ss, f, S, x, y)); + CCS_getFaceGridData(ss, f, S, x, y)); *origIndex = ORIGINDEX_NONE; ++mvert; ++origIndex; @@ -686,21 +686,21 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, } } } - *((int*)ccgSubSurf_getFaceUserData(ss, f)) = faceBase; + *((int*)CCS_getFaceUserData(ss, f)) = faceBase; faceBase += 1 + numVerts * ((gridSize-2) + (gridSize-2) * (gridSize-2)); } edgeBase = i; for(index = 0; index < totedge; index++) { - CCGEdge *e = edgeMap2[index]; + CCEdge *e = edgeMap2[index]; int x; int vertIdx[2]; - CCGVert *v; - v = ccgSubSurf_getEdgeVert0(e); - vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); - v = ccgSubSurf_getEdgeVert1(e); - vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + CCVert *v; + v = CCS_getEdgeVert0(e); + vertIdx[0] = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); + v = CCS_getEdgeVert1(e); + vertIdx[1] = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); for(x = 1; x < edgeSize - 1; x++) { float w2[2]; @@ -709,28 +709,28 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, w2[0] = 1 - w2[1]; DM_interp_vert_data(dm, result, vertIdx, w2, 2, i); - VecCopyf(mvert->co, ccgSubSurf_getEdgeData(ss, e, x)); + VecCopyf(mvert->co, CCS_getEdgeData(ss, e, x)); *origIndex = ORIGINDEX_NONE; ++mvert; ++origIndex; i++; } - *((int*)ccgSubSurf_getEdgeUserData(ss, e)) = edgeBase; + *((int*)CCS_getEdgeUserData(ss, e)) = edgeBase; edgeBase += edgeSize-2; } for(index = 0; index < totvert; index++) { - CCGVert *v = vertMap2[index]; + CCVert *v = vertMap2[index]; int vertIdx; - vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + vertIdx = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); DM_copy_vert_data(dm, result, vertIdx, i, 1); - VecCopyf(mvert->co, ccgSubSurf_getVertData(ss, v)); + VecCopyf(mvert->co, CCS_getVertData(ss, v)); - *((int*)ccgSubSurf_getVertUserData(ss, v)) = i; - *origIndex = ccgDM_getVertMapIndex(ss, v); + *((int*)CCS_getVertUserData(ss, v)) = i; + *origIndex = cgdm_getVertMapIndex(ss, v); ++mvert; ++origIndex; i++; @@ -742,8 +742,8 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, origIndex = result->getEdgeData(result, 0, CD_ORIGINDEX); for(index = 0; index < totface; index++) { - CCGFace *f = faceMap2[index]; - int numVerts = ccgSubSurf_getFaceNumVerts(f); + CCFace *f = faceMap2[index]; + int numVerts = CCS_getFaceNumVerts(f); for(k = 0; k < numVerts; k++) { for(x = 0; x < gridFaces; x++) { @@ -783,12 +783,12 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, } for(index = 0; index < totedge; index++) { - CCGEdge *e = edgeMap2[index]; + CCEdge *e = edgeMap2[index]; unsigned int flags = 0; char bweight = 0; - int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e)); + int edgeIdx = GET_INT_FROM_POINTER(CCS_getEdgeEdgeHandle(e)); - if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE; + if(!CCS_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE; if(edgeIdx != -1 && dm) { @@ -804,7 +804,7 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, med->v2 = getEdgeIndex(ss, e, x + 1, edgeSize); med->flag = flags; med->bweight = bweight; - *origIndex = ccgDM_getEdgeMapIndex(ss, e); + *origIndex = cgdm_getEdgeMapIndex(ss, e); ++med; ++origIndex; i++; @@ -817,12 +817,12 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, origIndex = result->getTessFaceData(result, 0, CD_ORIGINDEX); for(index = 0; index < totface; index++) { - CCGFace *f = faceMap2[index]; - int numVerts = ccgSubSurf_getFaceNumVerts(f); + CCFace *f = faceMap2[index]; + int numVerts = CCS_getFaceNumVerts(f); int mat_nr; int flag; - int mapIndex = ccgDM_getFaceMapIndex(ss, f); - int faceIdx = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); + int mapIndex = cgdm_getFaceMapIndex(ss, f); + int faceIdx = GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(ss, f)); if(!ssFromEditmesh) { MFace origMFace; @@ -831,7 +831,7 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, mat_nr = origMFace.mat_nr; flag = origMFace.flag; } else { - BMFace *ef = ccgSubSurf_getFaceFaceHandle(ss, f); + BMFace *ef = CCS_getFaceFaceHandle(ss, f); mat_nr = ef->mat_nr; flag = BMFlags_To_MEFlags(ef); } @@ -905,11 +905,11 @@ static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, return result; } -static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm, +static void ss_sync_from_derivedmesh(CSubSurf *ss, DerivedMesh *dm, float (*vertexCos)[3], int useFlatSubdiv) { - float creaseFactor = (float) ccgSubSurf_getSubdivisionLevels(ss); - CCGVertHDL *fVerts = NULL; + float creaseFactor = (float) CCS_getSubdivisionLevels(ss); + CCVertHDL *fVerts = NULL; V_DECLARE(fVerts); int totvert = dm->getNumVerts(dm); int totedge = dm->getNumEdges(dm); @@ -926,40 +926,40 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm, DMFaceIter *fiter; DMLoopIter *liter; - ccgSubSurf_initFullSync(ss); + CCS_initFullSync(ss); mv = mvert; index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX); for(i = 0; i < totvert; i++, mv++, index++) { - CCGVert *v; + CCVert *v; if(vertexCos) { - ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), vertexCos[i], 0, &v); + CCS_syncVert(ss, SET_INT_IN_POINTER(i), vertexCos[i], 0, &v); } else { - ccgSubSurf_syncVert(ss, SET_INT_IN_POINTER(i), mv->co, 0, &v); + CCS_syncVert(ss, SET_INT_IN_POINTER(i), mv->co, 0, &v); } - ((int*)ccgSubSurf_getVertUserData(ss, v))[1] = *index; + ((int*)CCS_getVertUserData(ss, v))[1] = *index; } me = medge; index = (int *)dm->getEdgeDataArray(dm, CD_ORIGINDEX); for(i = 0; i < totedge; i++, me++, index++) { - CCGEdge *e; + CCEdge *e; float crease; crease = useFlatSubdiv ? creaseFactor : me->crease * creaseFactor / 255.0f; - ccgSubSurf_syncEdge(ss, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(me->v1), + CCS_syncEdge(ss, SET_INT_IN_POINTER(i), SET_INT_IN_POINTER(me->v1), SET_INT_IN_POINTER(me->v2), crease, &e); - ((int*)ccgSubSurf_getEdgeUserData(ss, e))[1] = *index; + ((int*)CCS_getEdgeUserData(ss, e))[1] = *index; } fiter = dm->newFaceIter(dm); for (i=0; !fiter->done; fiter->step(fiter), i++) { - CCGFace *f; + CCFace *f; V_RESET(fVerts); index = (int*) fiter->getCDData(fiter, CD_ORIGINDEX, -1); @@ -974,7 +974,7 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm, * it is not really possible to continue without modifying * other parts of code significantly to handle missing faces. * since this really shouldn't even be possible we just bail.*/ - if(ccgSubSurf_syncFace(ss, SET_INT_IN_POINTER(i), fiter->len, + if(CCS_syncFace(ss, SET_INT_IN_POINTER(i), fiter->len, fVerts, &f) == eCCGError_InvalidValue) { static int hasGivenError = 0; @@ -988,59 +988,59 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm, return; } - ((int*)ccgSubSurf_getFaceUserData(ss, f))[1] = *index; + ((int*)CCS_getFaceUserData(ss, f))[1] = *index; } - ccgSubSurf_processSync(ss); + CCS_processSync(ss); } /***/ -static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v) { - return ((int*) ccgSubSurf_getVertUserData(ss, v))[1]; +static int cgdm_getVertMapIndex(CSubSurf *ss, CCVert *v) { + return ((int*) CCS_getVertUserData(ss, v))[1]; } -static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e) { - return ((int*) ccgSubSurf_getEdgeUserData(ss, e))[1]; +static int cgdm_getEdgeMapIndex(CSubSurf *ss, CCEdge *e) { + return ((int*) CCS_getEdgeUserData(ss, e))[1]; } -static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f) { - return ((int*) ccgSubSurf_getFaceUserData(ss, f))[1]; +static int cgdm_getFaceMapIndex(CSubSurf *ss, CCFace *f) { + return ((int*) CCS_getFaceUserData(ss, f))[1]; } -static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGVertIterator *vi = ccgSubSurf_getVertIterator(ss); - CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); - CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); - int i, edgeSize = ccgSubSurf_getEdgeSize(ss); - int gridSize = ccgSubSurf_getGridSize(ss); +static void cgdm_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCVertIterator *vi = CCS_getVertIterator(ss); + CCEdgeIterator *ei = CCS_getEdgeIterator(ss); + CCFaceIterator *fi = CCS_getFaceIterator(ss); + int i, edgeSize = CCS_getEdgeSize(ss); + int gridSize = CCS_getGridSize(ss); - if (!ccgSubSurf_getNumVerts(ss)) + if (!CCS_getNumVerts(ss)) min_r[0] = min_r[1] = min_r[2] = max_r[0] = max_r[1] = max_r[2] = 0.0; - for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { - CCGVert *v = ccgVertIterator_getCurrent(vi); - float *co = ccgSubSurf_getVertData(ss, v); + for (; !CCVIter_isStopped(vi); CCVIter_next(vi)) { + CCVert *v = CCVIter_getCurrent(vi); + float *co = CCS_getVertData(ss, v); DO_MINMAX(co, min_r, max_r); } - for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); + for (; !CCEIter_isStopped(ei); CCEIter_next(ei)) { + CCEdge *e = CCEIter_getCurrent(ei); + VertData *edgeData = CCS_getEdgeDataArray(ss, e); for (i=0; i<edgeSize; i++) DO_MINMAX(edgeData[i].co, min_r, max_r); } - for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); + for (; !CCFIter_isStopped(fi); CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); + int S, x, y, numVerts = CCS_getFaceNumVerts(f); for (S=0; S<numVerts; S++) { - VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); + VertData *faceGridData = CCS_getFaceGridDataArray(ss, f, S); for (y=0; y<gridSize; y++) for (x=0; x<gridSize; x++) @@ -1048,52 +1048,52 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) { } } - ccgFaceIterator_free(fi); - ccgEdgeIterator_free(ei); - ccgVertIterator_free(vi); + CCFIter_free(fi); + CCEIter_free(ei); + CCVIter_free(vi); } -static int ccgDM_getNumVerts(DerivedMesh *dm) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; +static int cgdm_getNumVerts(DerivedMesh *dm) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; - return ccgSubSurf_getNumFinalVerts(ccgdm->ss); + return CCS_getNumFinalVerts(cgdm->ss); } -static int ccgDM_getNumEdges(DerivedMesh *dm) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; +static int cgdm_getNumEdges(DerivedMesh *dm) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; - return ccgSubSurf_getNumFinalEdges(ccgdm->ss); + return CCS_getNumFinalEdges(cgdm->ss); } -static int ccgDM_getNumTessFaces(DerivedMesh *dm) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; +static int cgdm_getNumTessFaces(DerivedMesh *dm) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; - return ccgSubSurf_getNumFinalFaces(ccgdm->ss); + return CCS_getNumFinalFaces(cgdm->ss); } -static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv) +static void cgdm_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; int i; memset(mv, 0, sizeof(*mv)); - if((vertNum < ccgdm->edgeMap[0].startVert) && (ccgSubSurf_getNumTessFaces(ss) > 0)) { + if((vertNum < cgdm->edgeMap[0].startVert) && (CCS_getNumFaces(ss) > 0)) { /* this vert comes from face data */ - int lastface = ccgSubSurf_getNumTessFaces(ss) - 1; - CCGFace *f; + int lastface = CCS_getNumFaces(ss) - 1; + CCFace *f; int x, y, grid, numVerts; int offset; - int gridSize = ccgSubSurf_getGridSize(ss); + int gridSize = CCS_getGridSize(ss); int gridSideVerts; int gridInternalVerts; int gridSideEnd; int gridInternalEnd; i = 0; - while(i < lastface && vertNum >= ccgdm->faceMap[i + 1].startVert) + while(i < lastface && vertNum >= cgdm->faceMap[i + 1].startVert) ++i; - f = ccgdm->faceMap[i].face; - numVerts = ccgSubSurf_getFaceNumVerts(f); + f = cgdm->faceMap[i].face; + numVerts = CCS_getFaceNumVerts(f); gridSideVerts = gridSize - 2; gridInternalVerts = gridSideVerts * gridSideVerts; @@ -1101,76 +1101,76 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv) gridSideEnd = 1 + numVerts * gridSideVerts; gridInternalEnd = gridSideEnd + numVerts * gridInternalVerts; - offset = vertNum - ccgdm->faceMap[i].startVert; + offset = vertNum - cgdm->faceMap[i].startVert; if(offset < 1) { - VecCopyf(mv->co, ccgSubSurf_getFaceCenterData(f)); + VecCopyf(mv->co, CCS_getFaceCenterData(f)); } else if(offset < gridSideEnd) { offset -= 1; grid = offset / gridSideVerts; x = offset % gridSideVerts + 1; - VecCopyf(mv->co, ccgSubSurf_getFaceGridEdgeData(ss, f, grid, x)); + VecCopyf(mv->co, CCS_getFaceGridEdgeData(ss, f, grid, x)); } else if(offset < gridInternalEnd) { offset -= gridSideEnd; grid = offset / gridInternalVerts; offset %= gridInternalVerts; y = offset / gridSideVerts + 1; x = offset % gridSideVerts + 1; - VecCopyf(mv->co, ccgSubSurf_getFaceGridData(ss, f, grid, x, y)); + VecCopyf(mv->co, CCS_getFaceGridData(ss, f, grid, x, y)); } - } else if((vertNum < ccgdm->vertMap[0].startVert) && (ccgSubSurf_getNumEdges(ss) > 0)) { + } else if((vertNum < cgdm->vertMap[0].startVert) && (CCS_getNumEdges(ss) > 0)) { /* this vert comes from edge data */ - CCGEdge *e; - int lastedge = ccgSubSurf_getNumEdges(ss) - 1; + CCEdge *e; + int lastedge = CCS_getNumEdges(ss) - 1; int x; i = 0; - while(i < lastedge && vertNum >= ccgdm->edgeMap[i + 1].startVert) + while(i < lastedge && vertNum >= cgdm->edgeMap[i + 1].startVert) ++i; - e = ccgdm->edgeMap[i].edge; + e = cgdm->edgeMap[i].edge; - x = vertNum - ccgdm->edgeMap[i].startVert + 1; - VecCopyf(mv->co, ccgSubSurf_getEdgeData(ss, e, x)); + x = vertNum - cgdm->edgeMap[i].startVert + 1; + VecCopyf(mv->co, CCS_getEdgeData(ss, e, x)); } else { /* this vert comes from vert data */ - CCGVert *v; - i = vertNum - ccgdm->vertMap[0].startVert; + CCVert *v; + i = vertNum - cgdm->vertMap[0].startVert; - v = ccgdm->vertMap[i].vert; - VecCopyf(mv->co, ccgSubSurf_getVertData(ss, v)); + v = cgdm->vertMap[i].vert; + VecCopyf(mv->co, CCS_getVertData(ss, v)); } } -static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med) +static void cgdm_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; int i; memset(med, 0, sizeof(*med)); - if(edgeNum < ccgdm->edgeMap[0].startEdge) { + if(edgeNum < cgdm->edgeMap[0].startEdge) { /* this edge comes from face data */ - int lastface = ccgSubSurf_getNumTessFaces(ss) - 1; - CCGFace *f; + int lastface = CCS_getNumFaces(ss) - 1; + CCFace *f; int x, y, grid, numVerts; int offset; - int gridSize = ccgSubSurf_getGridSize(ss); - int edgeSize = ccgSubSurf_getEdgeSize(ss); + int gridSize = CCS_getGridSize(ss); + int edgeSize = CCS_getEdgeSize(ss); int gridSideEdges; int gridInternalEdges; i = 0; - while(i < lastface && edgeNum >= ccgdm->faceMap[i + 1].startEdge) + while(i < lastface && edgeNum >= cgdm->faceMap[i + 1].startEdge) ++i; - f = ccgdm->faceMap[i].face; - numVerts = ccgSubSurf_getFaceNumVerts(f); + f = cgdm->faceMap[i].face; + numVerts = CCS_getFaceNumVerts(f); gridSideEdges = gridSize - 1; gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2; - offset = edgeNum - ccgdm->faceMap[i].startEdge; + offset = edgeNum - cgdm->faceMap[i].startEdge; grid = offset / (gridSideEdges + gridInternalEdges); offset %= (gridSideEdges + gridInternalEdges); @@ -1192,18 +1192,18 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med) } } else { /* this vert comes from edge data */ - CCGEdge *e; - int edgeSize = ccgSubSurf_getEdgeSize(ss); + CCEdge *e; + int edgeSize = CCS_getEdgeSize(ss); int x, *edgeFlag; unsigned int flags = 0; - i = (edgeNum - ccgdm->edgeMap[0].startEdge) / (edgeSize - 1); + i = (edgeNum - cgdm->edgeMap[0].startEdge) / (edgeSize - 1); - e = ccgdm->edgeMap[i].edge; + e = cgdm->edgeMap[i].edge; - if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE; + if(!CCS_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE; - x = edgeNum - ccgdm->edgeMap[i].startEdge; + x = edgeNum - cgdm->edgeMap[i].startEdge; med->v1 = getEdgeIndex(ss, e, x, edgeSize); med->v2 = getEdgeIndex(ss, e, x+1, edgeSize); @@ -1219,33 +1219,33 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med) } } -static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf) +static void cgdm_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - int gridSize = ccgSubSurf_getGridSize(ss); - int edgeSize = ccgSubSurf_getEdgeSize(ss); + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + int gridSize = CCS_getGridSize(ss); + int edgeSize = CCS_getEdgeSize(ss); int gridSideEdges = gridSize - 1; int gridFaces = gridSideEdges * gridSideEdges; int i; - CCGFace *f; + CCFace *f; int numVerts; int offset; int grid; int x, y; - int lastface = ccgSubSurf_getNumTessFaces(ss) - 1; + int lastface = CCS_getNumFaces(ss) - 1; char *faceFlags = dm->getTessFaceDataArray(dm, CD_FLAGS); memset(mf, 0, sizeof(*mf)); i = 0; - while(i < lastface && faceNum >= ccgdm->faceMap[i + 1].startFace) + while(i < lastface && faceNum >= cgdm->faceMap[i + 1].startFace) ++i; - f = ccgdm->faceMap[i].face; - numVerts = ccgSubSurf_getFaceNumVerts(f); + f = cgdm->faceMap[i].face; + numVerts = CCS_getFaceNumVerts(f); - offset = faceNum - ccgdm->faceMap[i].startFace; + offset = faceNum - cgdm->faceMap[i].startFace; grid = offset / gridFaces; offset %= gridFaces; y = offset / gridSideEdges; @@ -1260,27 +1260,27 @@ static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf) else mf->flag = ME_SMOOTH; } -static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) +static void cgdm_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; int index; int totvert, totedge, totface; - int gridSize = ccgSubSurf_getGridSize(ss); - int edgeSize = ccgSubSurf_getEdgeSize(ss); + int gridSize = CCS_getGridSize(ss); + int edgeSize = CCS_getEdgeSize(ss); int i = 0; - totface = ccgSubSurf_getNumTessFaces(ss); + totface = CCS_getNumFaces(ss); for(index = 0; index < totface; index++) { - CCGFace *f = ccgdm->faceMap[index].face; - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); + CCFace *f = cgdm->faceMap[index].face; + int x, y, S, numVerts = CCS_getFaceNumVerts(f); - VecCopyf(mvert[i++].co, ccgSubSurf_getFaceCenterData(f)); + VecCopyf(mvert[i++].co, CCS_getFaceCenterData(f)); for(S = 0; S < numVerts; S++) { for(x = 1; x < gridSize - 1; x++) { VecCopyf(mvert[i++].co, - ccgSubSurf_getFaceGridEdgeData(ss, f, S, x)); + CCS_getFaceGridEdgeData(ss, f, S, x)); } } @@ -1288,53 +1288,53 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) for(y = 1; y < gridSize - 1; y++) { for(x = 1; x < gridSize - 1; x++) { VecCopyf(mvert[i++].co, - ccgSubSurf_getFaceGridData(ss, f, S, x, y)); + CCS_getFaceGridData(ss, f, S, x, y)); } } } } - totedge = ccgSubSurf_getNumEdges(ss); + totedge = CCS_getNumEdges(ss); for(index = 0; index < totedge; index++) { - CCGEdge *e = ccgdm->edgeMap[index].edge; + CCEdge *e = cgdm->edgeMap[index].edge; int x; for(x = 1; x < edgeSize - 1; x++) { - VecCopyf(mvert[i++].co, ccgSubSurf_getEdgeData(ss, e, x)); + VecCopyf(mvert[i++].co, CCS_getEdgeData(ss, e, x)); } } - totvert = ccgSubSurf_getNumVerts(ss); + totvert = CCS_getNumVerts(ss); for(index = 0; index < totvert; index++) { - CCGVert *v = ccgdm->vertMap[index].vert; + CCVert *v = cgdm->vertMap[index].vert; - VecCopyf(mvert[i].co, ccgSubSurf_getVertData(ss, v)); + VecCopyf(mvert[i].co, CCS_getVertData(ss, v)); i++; } } -static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) +static void cgdm_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; int index; int totedge, totface; - int gridSize = ccgSubSurf_getGridSize(ss); - int edgeSize = ccgSubSurf_getEdgeSize(ss); + int gridSize = CCS_getGridSize(ss); + int edgeSize = CCS_getEdgeSize(ss); int i = 0; int *edgeFlags = dm->getEdgeDataArray(dm, CD_FLAGS); - totface = ccgSubSurf_getNumTessFaces(ss); + totface = CCS_getNumFaces(ss); for(index = 0; index < totface; index++) { - CCGFace *f = ccgdm->faceMap[index].face; - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); + CCFace *f = cgdm->faceMap[index].face; + int x, y, S, numVerts = CCS_getFaceNumVerts(f); for(S = 0; S < numVerts; S++) { for(x = 0; x < gridSize - 1; x++) { MEdge *med = &medge[i]; - if(ccgdm->drawInteriorEdges) + if(cgdm->drawInteriorEdges) med->flag = ME_EDGEDRAW | ME_EDGERENDER; med->v1 = getFaceIndex(ss, f, S, x, 0, edgeSize, gridSize); med->v2 = getFaceIndex(ss, f, S, x + 1, 0, edgeSize, gridSize); @@ -1346,7 +1346,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) MEdge *med; med = &medge[i]; - if(ccgdm->drawInteriorEdges) + if(cgdm->drawInteriorEdges) med->flag = ME_EDGEDRAW | ME_EDGERENDER; med->v1 = getFaceIndex(ss, f, S, x, y, edgeSize, gridSize); @@ -1355,7 +1355,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) i++; med = &medge[i]; - if(ccgdm->drawInteriorEdges) + if(cgdm->drawInteriorEdges) med->flag = ME_EDGEDRAW | ME_EDGERENDER; med->v1 = getFaceIndex(ss, f, S, y, x, edgeSize, gridSize); @@ -1367,14 +1367,14 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) } } - totedge = ccgSubSurf_getNumEdges(ss); + totedge = CCS_getNumEdges(ss); for(index = 0; index < totedge; index++) { - CCGEdge *e = ccgdm->edgeMap[index].edge; + CCEdge *e = cgdm->edgeMap[index].edge; unsigned int flags = 0; int x; - int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e)); + int edgeIdx = GET_INT_FROM_POINTER(CCS_getEdgeEdgeHandle(e)); - if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE; + if(!CCS_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE; if(edgeFlags) { if(edgeIdx != -1) { @@ -1395,59 +1395,59 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) } } -struct ccgDM_faceIter; +struct cgdm_faceIter; -typedef struct ccgDM_loopIter { +typedef struct cgdm_loopIter { DMLoopIter head; int curloop; - CCGDerivedMesh *ccgdm; - struct ccgDM_faceIter *fiter; -} ccgDM_loopIter; + CCGDerivedMesh *cgdm; + struct cgdm_faceIter *fiter; +} cgdm_loopIter; -typedef struct ccgDM_faceIter { +typedef struct cgdm_faceIter { DMFaceIter head; - CCGDerivedMesh *ccgdm; + CCGDerivedMesh *cgdm; MFace mface; - ccgDM_loopIter liter; -} ccgDM_faceIter; + cgdm_loopIter liter; +} cgdm_faceIter; -void ccgDM_faceIterStep(void *self) +void cgdm_faceIterStep(void *self) { - ccgDM_faceIter *fiter = self; + cgdm_faceIter *fiter = self; - if (!fiter->ccgdm || !fiter->ccgdm->ss) { + if (!fiter->cgdm || !fiter->cgdm->ss) { fiter->head.done = 1; return; } - if (fiter->head.index >= ccgSubSurf_getNumTessFaces(fiter->ccgdm->ss)) { + if (fiter->head.index >= CCS_getNumFaces(fiter->cgdm->ss)) { fiter->head.done = 1; return; }; fiter->head.index++; - ccgDM_getFinalFace((DerivedMesh*)fiter->ccgdm, fiter->head.index, &fiter->mface); + cgdm_getFinalFace((DerivedMesh*)fiter->cgdm, fiter->head.index, &fiter->mface); fiter->head.flags = fiter->mface.flag; fiter->head.mat_nr = fiter->mface.mat_nr; fiter->head.len = fiter->mface.v4 ? 4 : 3; } -void *ccgDM_faceIterCData(void *self, int type, int layer) +void *cgdm_faceIterCData(void *self, int type, int layer) { - ccgDM_faceIter *fiter = self; + cgdm_faceIter *fiter = self; if (layer == -1) - return CustomData_get(&fiter->ccgdm->dm.faceData, fiter->head.index, type); + return CustomData_get(&fiter->cgdm->dm.faceData, fiter->head.index, type); else - return CustomData_get_n(&fiter->ccgdm->dm.faceData, type, fiter->head.index, layer); + return CustomData_get_n(&fiter->cgdm->dm.faceData, type, fiter->head.index, layer); } -void ccgDM_loopIterStep(void *self) +void cgdm_loopIterStep(void *self) { - ccgDM_loopIter *liter = self; + cgdm_loopIter *liter = self; MFace *mf = &liter->fiter->mface; int i, in; @@ -1477,30 +1477,30 @@ void ccgDM_loopIterStep(void *self) liter->head.vindex = in; /*we don't set .eindex*/ - ccgDM_getFinalVert((DerivedMesh*)liter->ccgdm, in, &liter->head.v); + cgdm_getFinalVert((DerivedMesh*)liter->cgdm, in, &liter->head.v); } -void *ccgDM_loopIterGetVCData(void *self, int type, int layer) +void *cgdm_loopIterGetVCData(void *self, int type, int layer) { - ccgDM_loopIter *liter = self; + cgdm_loopIter *liter = self; if (layer == -1) - return CustomData_get(&liter->ccgdm->dm.vertData, liter->head.vindex, type); - else return CustomData_get_n(&liter->ccgdm->dm.vertData, type, liter->head.vindex, layer); + return CustomData_get(&liter->cgdm->dm.vertData, liter->head.vindex, type); + else return CustomData_get_n(&liter->cgdm->dm.vertData, type, liter->head.vindex, layer); } -void *ccgDM_loopIterGetCData(void *self, int type, int layer) +void *cgdm_loopIterGetCData(void *self, int type, int layer) { - ccgDM_loopIter *liter = self; + cgdm_loopIter *liter = self; /*BMESH_TODO yeek, this has to convert mface-style uv/mcols to loop-style*/ return NULL; } -DMLoopIter *ccgDM_faceIterGetLIter(void *self) +DMLoopIter *cgdm_faceIterGetLIter(void *self) { - ccgDM_faceIter *fiter = self; + cgdm_faceIter *fiter = self; fiter->liter.head.index = -1; fiter->liter.head.done = 0; @@ -1509,39 +1509,39 @@ DMLoopIter *ccgDM_faceIterGetLIter(void *self) return (DMLoopIter*) &fiter->liter; } -DMFaceIter *ccgDM_newFaceIter(DerivedMesh *dm) +DMFaceIter *cgdm_newFaceIter(DerivedMesh *dm) { - ccgDM_faceIter *fiter = MEM_callocN(sizeof(ccgDM_faceIter), "ccgDM_faceIter"); + cgdm_faceIter *fiter = MEM_callocN(sizeof(cgdm_faceIter), "cgdm_faceIter"); fiter->head.free = MEM_freeN; - fiter->head.step = ccgDM_faceIterStep; + fiter->head.step = cgdm_faceIterStep; fiter->head.index = -1; - fiter->head.getCDData = ccgDM_faceIterCData; - fiter->head.getLoopsIter = ccgDM_faceIterGetLIter; + fiter->head.getCDData = cgdm_faceIterCData; + fiter->head.getLoopsIter = cgdm_faceIterGetLIter; fiter->liter.fiter = fiter; - fiter->liter.head.getLoopCDData = ccgDM_loopIterGetCData; - fiter->liter.head.getVertCDData = ccgDM_loopIterGetVCData; - fiter->liter.head.step = ccgDM_loopIterStep; + fiter->liter.head.getLoopCDData = cgdm_loopIterGetCData; + fiter->liter.head.getVertCDData = cgdm_loopIterGetVCData; + fiter->liter.head.step = cgdm_loopIterStep; fiter->head.step(fiter); } -static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface) +static void cgdm_copyFinalFaceArray(DerivedMesh *dm, MFace *mface) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; int index; int totface; - int gridSize = ccgSubSurf_getGridSize(ss); - int edgeSize = ccgSubSurf_getEdgeSize(ss); + int gridSize = CCS_getGridSize(ss); + int edgeSize = CCS_getEdgeSize(ss); int i = 0; char *faceFlags = dm->getTessFaceDataArray(dm, CD_FLAGS); - totface = ccgSubSurf_getNumTessFaces(ss); + totface = CCS_getNumFaces(ss); for(index = 0; index < totface; index++) { - CCGFace *f = ccgdm->faceMap[index].face; - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); + CCFace *f = cgdm->faceMap[index].face; + int x, y, S, numVerts = CCS_getFaceNumVerts(f); int mat_nr = 0; int flag = ME_SMOOTH; /* assume face is smooth by default */ @@ -1568,114 +1568,114 @@ static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface) } } -static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - int edgeSize = ccgSubSurf_getEdgeSize(ss); - int gridSize = ccgSubSurf_getGridSize(ss); +static void cgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + int edgeSize = CCS_getEdgeSize(ss); + int gridSize = CCS_getGridSize(ss); int i; - CCGVertIterator *vi; - CCGEdgeIterator *ei; - CCGFaceIterator *fi; - CCGFace **faceMap2; - CCGEdge **edgeMap2; - CCGVert **vertMap2; + CCVertIterator *vi; + CCEdgeIterator *ei; + CCFaceIterator *fi; + CCFace **faceMap2; + CCEdge **edgeMap2; + CCVert **vertMap2; int index, totvert, totedge, totface; - totvert = ccgSubSurf_getNumVerts(ss); + totvert = CCS_getNumVerts(ss); vertMap2 = MEM_mallocN(totvert*sizeof(*vertMap2), "vertmap"); - vi = ccgSubSurf_getVertIterator(ss); - for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { - CCGVert *v = ccgVertIterator_getCurrent(vi); + vi = CCS_getVertIterator(ss); + for (; !CCVIter_isStopped(vi); CCVIter_next(vi)) { + CCVert *v = CCVIter_getCurrent(vi); - vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))] = v; + vertMap2[GET_INT_FROM_POINTER(CCS_getVertVertHandle(v))] = v; } - ccgVertIterator_free(vi); + CCVIter_free(vi); - totedge = ccgSubSurf_getNumEdges(ss); + totedge = CCS_getNumEdges(ss); edgeMap2 = MEM_mallocN(totedge*sizeof(*edgeMap2), "edgemap"); - ei = ccgSubSurf_getEdgeIterator(ss); - for (i=0; !ccgEdgeIterator_isStopped(ei); i++,ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); + ei = CCS_getEdgeIterator(ss); + for (i=0; !CCEIter_isStopped(ei); i++,CCEIter_next(ei)) { + CCEdge *e = CCEIter_getCurrent(ei); - edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))] = e; + edgeMap2[GET_INT_FROM_POINTER(CCS_getEdgeEdgeHandle(e))] = e; } - totface = ccgSubSurf_getNumTessFaces(ss); + totface = CCS_getNumFaces(ss); faceMap2 = MEM_mallocN(totface*sizeof(*faceMap2), "facemap"); - fi = ccgSubSurf_getFaceIterator(ss); - for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); + fi = CCS_getFaceIterator(ss); + for (; !CCFIter_isStopped(fi); CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); - faceMap2[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f))] = f; + faceMap2[GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(ss, f))] = f; } - ccgFaceIterator_free(fi); + CCFIter_free(fi); i = 0; for (index=0; index<totface; index++) { - CCGFace *f = faceMap2[index]; - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); + CCFace *f = faceMap2[index]; + int x, y, S, numVerts = CCS_getFaceNumVerts(f); - VecCopyf(cos[i++], ccgSubSurf_getFaceCenterData(f)); + VecCopyf(cos[i++], CCS_getFaceCenterData(f)); for (S=0; S<numVerts; S++) { for (x=1; x<gridSize-1; x++) { - VecCopyf(cos[i++], ccgSubSurf_getFaceGridEdgeData(ss, f, S, x)); + VecCopyf(cos[i++], CCS_getFaceGridEdgeData(ss, f, S, x)); } } for (S=0; S<numVerts; S++) { for (y=1; y<gridSize-1; y++) { for (x=1; x<gridSize-1; x++) { - VecCopyf(cos[i++], ccgSubSurf_getFaceGridData(ss, f, S, x, y)); + VecCopyf(cos[i++], CCS_getFaceGridData(ss, f, S, x, y)); } } } } for (index=0; index<totedge; index++) { - CCGEdge *e= edgeMap2[index]; + CCEdge *e= edgeMap2[index]; int x; for (x=1; x<edgeSize-1; x++) { - VecCopyf(cos[i++], ccgSubSurf_getEdgeData(ss, e, x)); + VecCopyf(cos[i++], CCS_getEdgeData(ss, e, x)); } } for (index=0; index<totvert; index++) { - CCGVert *v = vertMap2[index]; - VecCopyf(cos[i++], ccgSubSurf_getVertData(ss, v)); + CCVert *v = vertMap2[index]; + VecCopyf(cos[i++], CCS_getVertData(ss, v)); } MEM_freeN(vertMap2); MEM_freeN(edgeMap2); MEM_freeN(faceMap2); } -static void ccgDM_foreachMappedVert(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no_f, short *no_s), void *userData) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGVertIterator *vi = ccgSubSurf_getVertIterator(ccgdm->ss); +static void cgdm_foreachMappedVert(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no_f, short *no_s), void *userData) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CCVertIterator *vi = CCS_getVertIterator(cgdm->ss); - for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { - CCGVert *v = ccgVertIterator_getCurrent(vi); - VertData *vd = ccgSubSurf_getVertData(ccgdm->ss, v); - int index = ccgDM_getVertMapIndex(ccgdm->ss, v); + for (; !CCVIter_isStopped(vi); CCVIter_next(vi)) { + CCVert *v = CCVIter_getCurrent(vi); + VertData *vd = CCS_getVertData(cgdm->ss, v); + int index = cgdm_getVertMapIndex(cgdm->ss, v); if (index!=-1) func(userData, index, vd->co, vd->no, NULL); } - ccgVertIterator_free(vi); + CCVIter_free(vi); } -static void ccgDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData, int index, float *v0co, float *v1co), void *userData) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); - int i, edgeSize = ccgSubSurf_getEdgeSize(ss); +static void cgdm_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData, int index, float *v0co, float *v1co), void *userData) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCEdgeIterator *ei = CCS_getEdgeIterator(ss); + int i, edgeSize = CCS_getEdgeSize(ss); - for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - int index = ccgDM_getEdgeMapIndex(ss, e); + for (; !CCEIter_isStopped(ei); CCEIter_next(ei)) { + CCEdge *e = CCEIter_getCurrent(ei); + VertData *edgeData = CCS_getEdgeDataArray(ss, e); + int index = cgdm_getEdgeMapIndex(ss, e); if (index!=-1) { for (i=0; i<edgeSize-1; i++) @@ -1683,73 +1683,73 @@ static void ccgDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData } } - ccgEdgeIterator_free(ei); + CCEIter_free(ei); } -static void ccgDM_drawVerts(DerivedMesh *dm) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - int edgeSize = ccgSubSurf_getEdgeSize(ss); - int gridSize = ccgSubSurf_getGridSize(ss); - CCGVertIterator *vi; - CCGEdgeIterator *ei; - CCGFaceIterator *fi; +static void cgdm_drawVerts(DerivedMesh *dm) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + int edgeSize = CCS_getEdgeSize(ss); + int gridSize = CCS_getGridSize(ss); + CCVertIterator *vi; + CCEdgeIterator *ei; + CCFaceIterator *fi; glBegin(GL_POINTS); - vi = ccgSubSurf_getVertIterator(ss); - for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { - CCGVert *v = ccgVertIterator_getCurrent(vi); - glVertex3fv(ccgSubSurf_getVertData(ss, v)); + vi = CCS_getVertIterator(ss); + for (; !CCVIter_isStopped(vi); CCVIter_next(vi)) { + CCVert *v = CCVIter_getCurrent(vi); + glVertex3fv(CCS_getVertData(ss, v)); } - ccgVertIterator_free(vi); + CCVIter_free(vi); - ei = ccgSubSurf_getEdgeIterator(ss); - for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); + ei = CCS_getEdgeIterator(ss); + for (; !CCEIter_isStopped(ei); CCEIter_next(ei)) { + CCEdge *e = CCEIter_getCurrent(ei); int x; for (x=1; x<edgeSize-1; x++) - glVertex3fv(ccgSubSurf_getEdgeData(ss, e, x)); + glVertex3fv(CCS_getEdgeData(ss, e, x)); } - ccgEdgeIterator_free(ei); + CCEIter_free(ei); - fi = ccgSubSurf_getFaceIterator(ss); - for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); + fi = CCS_getFaceIterator(ss); + for (; !CCFIter_isStopped(fi); CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); + int x, y, S, numVerts = CCS_getFaceNumVerts(f); - glVertex3fv(ccgSubSurf_getFaceCenterData(f)); + glVertex3fv(CCS_getFaceCenterData(f)); for (S=0; S<numVerts; S++) for (x=1; x<gridSize-1; x++) - glVertex3fv(ccgSubSurf_getFaceGridEdgeData(ss, f, S, x)); + glVertex3fv(CCS_getFaceGridEdgeData(ss, f, S, x)); for (S=0; S<numVerts; S++) for (y=1; y<gridSize-1; y++) for (x=1; x<gridSize-1; x++) - glVertex3fv(ccgSubSurf_getFaceGridData(ss, f, S, x, y)); + glVertex3fv(CCS_getFaceGridData(ss, f, S, x, y)); } - ccgFaceIterator_free(fi); + CCFIter_free(fi); glEnd(); } -static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); - CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); - int i, edgeSize = ccgSubSurf_getEdgeSize(ss); - int gridSize = ccgSubSurf_getGridSize(ss); +static void cgdm_drawEdges(DerivedMesh *dm, int drawLooseEdges) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCEdgeIterator *ei = CCS_getEdgeIterator(ss); + CCFaceIterator *fi = CCS_getFaceIterator(ss); + int i, edgeSize = CCS_getEdgeSize(ss); + int gridSize = CCS_getGridSize(ss); int useAging; - ccgSubSurf_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL); + CCS_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL); - for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); + for (; !CCEIter_isStopped(ei); CCEIter_next(ei)) { + CCEdge *e = CCEIter_getCurrent(ei); + VertData *edgeData = CCS_getEdgeDataArray(ss, e); - if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(e)) + if (!drawLooseEdges && !CCS_getEdgeNumFaces(e)) continue; if (useAging && !(G.f&G_BACKBUFSEL)) { - int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4; + int ageCol = 255-CCS_getEdgeAge(ss, e)*4; glColor3ub(0, ageCol>0?ageCol:0, 0); } @@ -1765,13 +1765,13 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) { glColor3ub(0, 0, 0); } - if (ccgdm->drawInteriorEdges) { - for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); + if (cgdm->drawInteriorEdges) { + for (; !CCFIter_isStopped(fi); CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); + int S, x, y, numVerts = CCS_getFaceNumVerts(f); for (S=0; S<numVerts; S++) { - VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); + VertData *faceGridData = CCS_getFaceGridDataArray(ss, f, S); glBegin(GL_LINE_STRIP); for (x=0; x<gridSize; x++) @@ -1793,20 +1793,20 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) { } } - ccgFaceIterator_free(fi); - ccgEdgeIterator_free(ei); + CCFIter_free(fi); + CCEIter_free(ei); } -static void ccgDM_drawLooseEdges(DerivedMesh *dm) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); - int i, edgeSize = ccgSubSurf_getEdgeSize(ss); +static void cgdm_drawLooseEdges(DerivedMesh *dm) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCEdgeIterator *ei = CCS_getEdgeIterator(ss); + int i, edgeSize = CCS_getEdgeSize(ss); - for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); + for (; !CCEIter_isStopped(ei); CCEIter_next(ei)) { + CCEdge *e = CCEIter_getCurrent(ei); + VertData *edgeData = CCS_getEdgeDataArray(ss, e); - if (!ccgSubSurf_getEdgeNumFaces(e)) { + if (!CCS_getEdgeNumFaces(e)) { glBegin(GL_LINE_STRIP); for (i=0; i<edgeSize-1; i++) { glVertex3fv(edgeData[i].co); @@ -1816,10 +1816,10 @@ static void ccgDM_drawLooseEdges(DerivedMesh *dm) { } } - ccgEdgeIterator_free(ei); + CCEIter_free(ei); } -static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d) +static void cgdm_glNormalFast(float *a, float *b, float *c, float *d) { float a_cX = c[0]-a[0], a_cY = c[1]-a[1], a_cZ = c[2]-a[2]; float b_dX = d[0]-b[0], b_dY = d[1]-b[1], b_dZ = d[2]-b[2]; @@ -1834,17 +1834,17 @@ static void ccgDM_glNormalFast(float *a, float *b, float *c, float *d) } /* Only used by non-editmesh types */ -static void ccgDM_drawFacesSolid(DerivedMesh *dm, int (*setMaterial)(int, void *attribs)) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); - int gridSize = ccgSubSurf_getGridSize(ss); - char *faceFlags = DM_get_face_data_layer(dm, CD_FLAGS); - - for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); - int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); +static void cgdm_drawFacesSolid(DerivedMesh *dm, int (*setMaterial)(int, void *attribs)) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCFaceIterator *fi = CCS_getFaceIterator(ss); + int gridSize = CCS_getGridSize(ss); + char *faceFlags = DM_get_tessface_data_layer(dm, CD_FLAGS); + + for (; !CCFIter_isStopped(fi); CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); + int S, x, y, numVerts = CCS_getFaceNumVerts(f); + int index = GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(ss, f)); int drawSmooth, mat_nr; if(faceFlags) { @@ -1861,7 +1861,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, int (*setMaterial)(int, void * glShadeModel(drawSmooth? GL_SMOOTH: GL_FLAT); for (S=0; S<numVerts; S++) { - VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); + VertData *faceGridData = CCS_getFaceGridDataArray(ss, f, S); if (drawSmooth) { for (y=0; y<gridSize-1; y++) { @@ -1886,7 +1886,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, int (*setMaterial)(int, void * float *c = faceGridData[(y+1)*gridSize + x + 1].co; float *d = faceGridData[(y+1)*gridSize + x].co; - ccgDM_glNormalFast(a, b, c, d); + cgdm_glNormalFast(a, b, c, d); glVertex3fv(d); glVertex3fv(c); @@ -1899,22 +1899,22 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, int (*setMaterial)(int, void * } } - ccgFaceIterator_free(fi); + CCFIter_free(fi); } /* Only used by non-editmesh types */ -static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs), int (*setDrawOptions)(void *userData, int index), void *userData) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); +static void cgdm_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs), int (*setDrawOptions)(void *userData, int index), void *userData) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCFaceIterator *fi = CCS_getFaceIterator(ss); GPUVertexAttribs gattribs; DMVertexAttribs attribs; MTFace *tf = dm->getTessFaceDataArray(dm, CD_MTFACE); - int gridSize = ccgSubSurf_getGridSize(ss); + int gridSize = CCS_getGridSize(ss); int gridFaces = gridSize - 1; - int edgeSize = ccgSubSurf_getEdgeSize(ss); + int edgeSize = CCS_getEdgeSize(ss); int transp, orig_transp, new_transp; - char *faceFlags = DM_get_face_data_layer(dm, CD_FLAGS); + char *faceFlags = DM_get_tessface_data_layer(dm, CD_FLAGS); int a, b, i, doDraw, numVerts, matnr, new_matnr, totface; doDraw = 0; @@ -1946,14 +1946,14 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, v } \ } - totface = ccgSubSurf_getNumTessFaces(ss); + totface = CCS_getNumFaces(ss); for(a = 0, i = 0; i < totface; i++) { - CCGFace *f = ccgdm->faceMap[i].face; + CCFace *f = cgdm->faceMap[i].face; int S, x, y, drawSmooth; - int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); - int origIndex = ccgDM_getFaceMapIndex(ss, f); + int index = GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(ss, f)); + int origIndex = cgdm_getFaceMapIndex(ss, f); - numVerts = ccgSubSurf_getFaceNumVerts(f); + numVerts = CCS_getFaceNumVerts(f); if(faceFlags) { drawSmooth = (faceFlags[index*4] & ME_SMOOTH); @@ -1989,7 +1989,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, v glShadeModel(drawSmooth? GL_SMOOTH: GL_FLAT); for (S=0; S<numVerts; S++) { - VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); + VertData *faceGridData = CCS_getFaceGridDataArray(ss, f, S); VertData *vda, *vdb; if (drawSmooth) { @@ -2035,7 +2035,7 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, v float *cco = faceGridData[(y+1)*gridSize + x + 1].co; float *dco = faceGridData[(y+1)*gridSize + x].co; - ccgDM_glNormalFast(aco, bco, cco, dco); + cgdm_glNormalFast(aco, bco, cco, dco); PASSATTRIB(0, 1, 1); glVertex3fv(dco); @@ -2056,18 +2056,18 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, v #undef PASSATTRIB - ccgFaceIterator_free(fi); + CCFIter_free(fi); } -static void ccgDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs)) { +static void cgdm_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs)) { dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL); } -static void ccgDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned char *col1, unsigned char *col2) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); - int gridSize = ccgSubSurf_getGridSize(ss); +static void cgdm_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned char *col1, unsigned char *col2) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCFaceIterator *fi = CCS_getFaceIterator(ss); + int gridSize = CCS_getGridSize(ss); unsigned char *cp1, *cp2; int useTwoSide=1; @@ -2084,12 +2084,12 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned ch glEnable(GL_CULL_FACE); glBegin(GL_QUADS); - for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); + for (; !CCFIter_isStopped(fi); CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); + int S, x, y, numVerts = CCS_getFaceNumVerts(f); for (S=0; S<numVerts; S++) { - VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); + VertData *faceGridData = CCS_getFaceGridDataArray(ss, f, S); for (y=0; y<gridSize-1; y++) { for (x=0; x<gridSize-1; x++) { float *a = faceGridData[(y+0)*gridSize + x].co; @@ -2125,28 +2125,28 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned ch } glEnd(); - ccgFaceIterator_free(fi); + CCFIter_free(fi); } -static void ccgDM_drawFacesTex_common(DerivedMesh *dm, +static void cgdm_drawFacesTex_common(DerivedMesh *dm, int (*drawParams)(MTFace *tface, MCol *mcol, int matnr), int (*drawParamsMapped)(void *userData, int index), void *userData) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - MCol *mcol = DM_get_face_data_layer(dm, CD_MCOL); - MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE); - char *faceFlags = DM_get_face_data_layer(dm, CD_FLAGS); - int i, totface, flag, gridSize = ccgSubSurf_getGridSize(ss); + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + MCol *mcol = DM_get_tessface_data_layer(dm, CD_MCOL); + MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE); + char *faceFlags = DM_get_tessface_data_layer(dm, CD_FLAGS); + int i, totface, flag, gridSize = CCS_getGridSize(ss); int gridFaces = gridSize - 1; - totface = ccgSubSurf_getNumTessFaces(ss); + totface = CCS_getNumFaces(ss); for(i = 0; i < totface; i++) { - CCGFace *f = ccgdm->faceMap[i].face; - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); - int drawSmooth, index = ccgDM_getFaceMapIndex(ss, f); - int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); + CCFace *f = cgdm->faceMap[i].face; + int S, x, y, numVerts = CCS_getFaceNumVerts(f); + int drawSmooth, index = cgdm_getFaceMapIndex(ss, f); + int origIndex = GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(ss, f)); unsigned char *cp= NULL; int mat_nr; @@ -2177,7 +2177,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, } for (S=0; S<numVerts; S++) { - VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); + VertData *faceGridData = CCS_getFaceGridDataArray(ss, f, S); VertData *a, *b; if (drawSmooth) { @@ -2232,7 +2232,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, float *c_co = faceGridData[(y+1)*gridSize + x + 1].co; float *d_co = faceGridData[(y+1)*gridSize + x].co; - ccgDM_glNormalFast(a_co, b_co, c_co, d_co); + cgdm_glNormalFast(a_co, b_co, c_co, d_co); if(tf) glTexCoord2fv(tf->uv[1]); if(cp) glColor3ub(cp[7], cp[6], cp[5]); @@ -2260,21 +2260,21 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, } } -static void ccgDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, MCol *mcol, int matnr)) +static void cgdm_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, MCol *mcol, int matnr)) { - ccgDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); + cgdm_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } -static void ccgDM_drawMappedFacesTex(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData) +static void cgdm_drawMappedFacesTex(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData) { - ccgDM_drawFacesTex_common(dm, NULL, setDrawOptions, userData); + cgdm_drawFacesTex_common(dm, NULL, setDrawOptions, userData); } -static void ccgDM_drawUVEdges(DerivedMesh *dm) +static void cgdm_drawUVEdges(DerivedMesh *dm) { MFace *mf = dm->getTessFaceArray(dm); - MTFace *tf = DM_get_face_data_layer(dm, CD_MTFACE); + MTFace *tf = DM_get_tessface_data_layer(dm, CD_MTFACE); int i; if (tf) { @@ -2303,20 +2303,20 @@ static void ccgDM_drawUVEdges(DerivedMesh *dm) } } -static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); - int i, gridSize = ccgSubSurf_getGridSize(ss); +static void cgdm_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCFaceIterator *fi = CCS_getFaceIterator(ss); + int i, gridSize = CCS_getGridSize(ss); char *faceFlags = dm->getTessFaceDataArray(dm, CD_FLAGS); - for (i=0; !ccgFaceIterator_isStopped(fi); i++,ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); - int drawSmooth, index = ccgDM_getFaceMapIndex(ss, f); + for (i=0; !CCFIter_isStopped(fi); i++,CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); + int S, x, y, numVerts = CCS_getFaceNumVerts(f); + int drawSmooth, index = cgdm_getFaceMapIndex(ss, f); int origIndex; - origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); + origIndex = GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(ss, f)); if(faceFlags) drawSmooth = (faceFlags[origIndex*4] & ME_SMOOTH); else drawSmooth = 1; @@ -2332,7 +2332,7 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *u } for (S=0; S<numVerts; S++) { - VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); + VertData *faceGridData = CCS_getFaceGridDataArray(ss, f, S); if (drawSmooth) { glShadeModel(GL_SMOOTH); for (y=0; y<gridSize-1; y++) { @@ -2381,25 +2381,25 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *u } } - ccgFaceIterator_free(fi); + CCFIter_free(fi); } -static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); - int i, useAging, edgeSize = ccgSubSurf_getEdgeSize(ss); +static void cgdm_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCEdgeIterator *ei = CCS_getEdgeIterator(ss); + int i, useAging, edgeSize = CCS_getEdgeSize(ss); - ccgSubSurf_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL); + CCS_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL); - for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - int index = ccgDM_getEdgeMapIndex(ss, e); + for (; !CCEIter_isStopped(ei); CCEIter_next(ei)) { + CCEdge *e = CCEIter_getCurrent(ei); + VertData *edgeData = CCS_getEdgeDataArray(ss, e); + int index = cgdm_getEdgeMapIndex(ss, e); glBegin(GL_LINE_STRIP); if (index!=-1 && (!setDrawOptions || setDrawOptions(userData, index))) { if (useAging && !(G.f&G_BACKBUFSEL)) { - int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4; + int ageCol = 255-CCS_getEdgeAge(ss, e)*4; glColor3ub(0, ageCol>0?ageCol:0, 0); } @@ -2411,20 +2411,20 @@ static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *u glEnd(); } - ccgEdgeIterator_free(ei); + CCEIter_free(ei); } -static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void (*setDrawInterpOptions)(void *userData, int index, float t), void *userData) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGEdgeIterator *ei = ccgSubSurf_getEdgeIterator(ss); - int i, useAging, edgeSize = ccgSubSurf_getEdgeSize(ss); +static void cgdm_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void (*setDrawInterpOptions)(void *userData, int index, float t), void *userData) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCEdgeIterator *ei = CCS_getEdgeIterator(ss); + int i, useAging, edgeSize = CCS_getEdgeSize(ss); - ccgSubSurf_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL); + CCS_getUseAgeCounts(ss, &useAging, NULL, NULL, NULL); - for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - int index = ccgDM_getEdgeMapIndex(ss, e); + for (; !CCEIter_isStopped(ei); CCEIter_next(ei)) { + CCEdge *e = CCEIter_getCurrent(ei); + VertData *edgeData = CCS_getEdgeDataArray(ss, e); + int index = cgdm_getEdgeMapIndex(ss, e); glBegin(GL_LINE_STRIP); if (index!=-1 && (!setDrawOptions || setDrawOptions(userData, index))) { @@ -2432,7 +2432,7 @@ static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(v setDrawInterpOptions(userData, index, (float) i/(edgeSize-1)); if (useAging && !(G.f&G_BACKBUFSEL)) { - int ageCol = 255-ccgSubSurf_getEdgeAge(ss, e)*4; + int ageCol = 255-CCS_getEdgeAge(ss, e)*4; glColor3ub(0, ageCol>0?ageCol:0, 0); } @@ -2442,156 +2442,166 @@ static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(v glEnd(); } - ccgEdgeIterator_free(ei); + CCEIter_free(ei); } -static void ccgDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no), void *userData) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; - CCGSubSurf *ss = ccgdm->ss; - CCGFaceIterator *fi = ccgSubSurf_getFaceIterator(ss); +static void cgdm_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *userData, int index, float *co, float *no), void *userData) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; + CSubSurf *ss = cgdm->ss; + CCFaceIterator *fi = CCS_getFaceIterator(ss); - for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); - int index = ccgDM_getFaceMapIndex(ss, f); + for (; !CCFIter_isStopped(fi); CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); + int index = cgdm_getFaceMapIndex(ss, f); if (index!=-1) { /* Face center data normal isn't updated atm. */ - VertData *vd = ccgSubSurf_getFaceGridData(ss, f, 0, 0, 0); + VertData *vd = CCS_getFaceGridData(ss, f, 0, 0, 0); func(userData, index, vd->co, vd->no); } } - ccgFaceIterator_free(fi); + CCFIter_free(fi); } -static void ccgDM_release(DerivedMesh *dm) { - CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm; +static void cgdm_release(DerivedMesh *dm) { + CCGDerivedMesh *cgdm = (CCGDerivedMesh*) dm; if (DM_release(dm)) { - MEM_freeN(ccgdm->vertMap); - MEM_freeN(ccgdm->edgeMap); - MEM_freeN(ccgdm->faceMap); - MEM_freeN(ccgdm); + MEM_freeN(cgdm->vertMap); + MEM_freeN(cgdm->edgeMap); + MEM_freeN(cgdm->faceMap); + MEM_freeN(cgdm); } } -static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, +static CCGDerivedMesh *getCCGDerivedMesh(CSubSurf *ss, int drawInteriorEdges, int useSubsurfUv, DerivedMesh *dm) { - CCGDerivedMesh *ccgdm = MEM_callocN(sizeof(*ccgdm), "ccgdm"); - CCGVertIterator *vi; - CCGEdgeIterator *ei; - CCGFaceIterator *fi; + CCGDerivedMesh *cgdm = MEM_callocN(sizeof(*cgdm), "cgdm"); + CCVertIterator *vi; + CCEdgeIterator *ei; + CCFaceIterator *fi; int index, totvert, totedge, totface; int i; int vertNum, edgeNum, faceNum; - int *vertOrigIndex, *faceOrigIndex; /* *edgeOrigIndex - as yet, unused */ + int *vertOrigIndex, *faceOrigIndex, *polyOrigIndex; /* *edgeOrigIndex - as yet, unused */ int *edgeFlags; - char *faceFlags; + char *faceFlags, *polyFlags; + int *loopidx = NULL; + V_DECLARE(loopidx); + int loopindex, loopindex2; int edgeSize; int gridSize; int gridFaces; - int *vertIdx = NULL; - V_DECLARE(vertIdx); int gridSideVerts; /*int gridInternalVerts; - as yet unused */ int gridSideEdges; int gridInternalEdges; + int index2; + float *w = NULL; + DMFaceIter *dfiter, *dfiter2; + DMLoopIter *dliter, *dliter2; + V_DECLARE(w); /* MVert *mvert = NULL; - as yet unused */ MEdge *medge = NULL; MFace *mface = NULL; + /*a spare loop that's not used by anything*/ + int temp_loop = CCS_getNumFinalFaces(ss)*4; FaceVertWeight *qweight, *tweight; - DM_from_template(&ccgdm->dm, dm, ccgSubSurf_getNumFinalVerts(ss), - ccgSubSurf_getNumFinalEdges(ss), - ccgSubSurf_getNumFinalFaces(ss), - 0, 0); - DM_add_face_layer(&ccgdm->dm, CD_FLAGS, CD_CALLOC, NULL); - DM_add_edge_layer(&ccgdm->dm, CD_FLAGS, CD_CALLOC, NULL); - - CustomData_set_layer_flag(&ccgdm->dm.faceData, CD_FLAGS, CD_FLAG_NOCOPY); - CustomData_set_layer_flag(&ccgdm->dm.edgeData, CD_FLAGS, CD_FLAG_NOCOPY); - - ccgdm->dm.getMinMax = ccgDM_getMinMax; - ccgdm->dm.getNumVerts = ccgDM_getNumVerts; - ccgdm->dm.getNumTessFaces = ccgDM_getNumTessFaces; - ccgdm->dm.getNumFaces = ccgDM_getNumTessFaces; - - ccgdm->dm.newFaceIter = ccgDM_newFaceIter; - - ccgdm->dm.getNumEdges = ccgDM_getNumEdges; - ccgdm->dm.getVert = ccgDM_getFinalVert; - ccgdm->dm.getEdge = ccgDM_getFinalEdge; - ccgdm->dm.getTessFace = ccgDM_getFinalFace; - ccgdm->dm.copyVertArray = ccgDM_copyFinalVertArray; - ccgdm->dm.copyEdgeArray = ccgDM_copyFinalEdgeArray; - ccgdm->dm.copyTessFaceArray = ccgDM_copyFinalFaceArray; - ccgdm->dm.getVertData = DM_get_vert_data; - ccgdm->dm.getEdgeData = DM_get_edge_data; - ccgdm->dm.getTessFaceData = DM_get_face_data; - ccgdm->dm.getVertDataArray = DM_get_vert_data_layer; - ccgdm->dm.getEdgeDataArray = DM_get_edge_data_layer; - ccgdm->dm.getTessFaceDataArray = DM_get_face_data_layer; - - ccgdm->dm.getVertCos = ccgdm_getVertCos; - ccgdm->dm.foreachMappedVert = ccgDM_foreachMappedVert; - ccgdm->dm.foreachMappedEdge = ccgDM_foreachMappedEdge; - ccgdm->dm.foreachMappedFaceCenter = ccgDM_foreachMappedFaceCenter; + DM_from_template(&cgdm->dm, dm, CCS_getNumFinalVerts(ss), + CCS_getNumFinalEdges(ss), + CCS_getNumFinalFaces(ss), + CCS_getNumFinalFaces(ss)*4+1, + CCS_getNumFinalFaces(ss)); + DM_add_tessface_layer(&cgdm->dm, CD_FLAGS, CD_CALLOC, NULL); + DM_add_face_layer(&cgdm->dm, CD_FLAGS, CD_CALLOC, NULL); + DM_add_edge_layer(&cgdm->dm, CD_FLAGS, CD_CALLOC, NULL); + + CustomData_set_layer_flag(&cgdm->dm.faceData, CD_FLAGS, CD_FLAG_NOCOPY); + CustomData_set_layer_flag(&cgdm->dm.edgeData, CD_FLAGS, CD_FLAG_NOCOPY); + + cgdm->dm.getMinMax = cgdm_getMinMax; + cgdm->dm.getNumVerts = cgdm_getNumVerts; + cgdm->dm.getNumTessFaces = cgdm_getNumTessFaces; + cgdm->dm.getNumFaces = cgdm_getNumTessFaces; + + cgdm->dm.newFaceIter = cgdm_newFaceIter; + + cgdm->dm.getNumEdges = cgdm_getNumEdges; + cgdm->dm.getVert = cgdm_getFinalVert; + cgdm->dm.getEdge = cgdm_getFinalEdge; + cgdm->dm.getTessFace = cgdm_getFinalFace; + cgdm->dm.copyVertArray = cgdm_copyFinalVertArray; + cgdm->dm.copyEdgeArray = cgdm_copyFinalEdgeArray; + cgdm->dm.copyTessFaceArray = cgdm_copyFinalFaceArray; + cgdm->dm.getVertData = DM_get_vert_data; + cgdm->dm.getEdgeData = DM_get_edge_data; + cgdm->dm.getTessFaceData = DM_get_face_data; + cgdm->dm.getVertDataArray = DM_get_vert_data_layer; + cgdm->dm.getEdgeDataArray = DM_get_edge_data_layer; + cgdm->dm.getTessFaceDataArray = DM_get_tessface_data_layer; + + cgdm->dm.getVertCos = cgdm_getVertCos; + cgdm->dm.foreachMappedVert = cgdm_foreachMappedVert; + cgdm->dm.foreachMappedEdge = cgdm_foreachMappedEdge; + cgdm->dm.foreachMappedFaceCenter = cgdm_foreachMappedFaceCenter; - ccgdm->dm.drawVerts = ccgDM_drawVerts; - ccgdm->dm.drawEdges = ccgDM_drawEdges; - ccgdm->dm.drawLooseEdges = ccgDM_drawLooseEdges; - ccgdm->dm.drawFacesSolid = ccgDM_drawFacesSolid; - ccgdm->dm.drawFacesColored = ccgDM_drawFacesColored; - ccgdm->dm.drawFacesTex = ccgDM_drawFacesTex; - ccgdm->dm.drawFacesGLSL = ccgDM_drawFacesGLSL; - ccgdm->dm.drawMappedFaces = ccgDM_drawMappedFaces; - ccgdm->dm.drawMappedFacesTex = ccgDM_drawMappedFacesTex; - ccgdm->dm.drawMappedFacesGLSL = ccgDM_drawMappedFacesGLSL; - ccgdm->dm.drawUVEdges = ccgDM_drawUVEdges; - - ccgdm->dm.drawMappedEdgesInterp = ccgDM_drawMappedEdgesInterp; - ccgdm->dm.drawMappedEdges = ccgDM_drawMappedEdges; + cgdm->dm.drawVerts = cgdm_drawVerts; + cgdm->dm.drawEdges = cgdm_drawEdges; + cgdm->dm.drawLooseEdges = cgdm_drawLooseEdges; + cgdm->dm.drawFacesSolid = cgdm_drawFacesSolid; + cgdm->dm.drawFacesColored = cgdm_drawFacesColored; + cgdm->dm.drawFacesTex = cgdm_drawFacesTex; + cgdm->dm.drawFacesGLSL = cgdm_drawFacesGLSL; + cgdm->dm.drawMappedFaces = cgdm_drawMappedFaces; + cgdm->dm.drawMappedFacesTex = cgdm_drawMappedFacesTex; + cgdm->dm.drawMappedFacesGLSL = cgdm_drawMappedFacesGLSL; + cgdm->dm.drawUVEdges = cgdm_drawUVEdges; + + cgdm->dm.drawMappedEdgesInterp = cgdm_drawMappedEdgesInterp; + cgdm->dm.drawMappedEdges = cgdm_drawMappedEdges; - ccgdm->dm.release = ccgDM_release; + cgdm->dm.release = cgdm_release; - ccgdm->ss = ss; - ccgdm->drawInteriorEdges = drawInteriorEdges; - ccgdm->useSubsurfUv = useSubsurfUv; + cgdm->ss = ss; + cgdm->drawInteriorEdges = drawInteriorEdges; + cgdm->useSubsurfUv = useSubsurfUv; - totvert = ccgSubSurf_getNumVerts(ss); - ccgdm->vertMap = MEM_mallocN(totvert * sizeof(*ccgdm->vertMap), "vertMap"); - vi = ccgSubSurf_getVertIterator(ss); - for(; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { - CCGVert *v = ccgVertIterator_getCurrent(vi); + totvert = CCS_getNumVerts(ss); + cgdm->vertMap = MEM_mallocN(totvert * sizeof(*cgdm->vertMap), "vertMap"); + vi = CCS_getVertIterator(ss); + for(; !CCVIter_isStopped(vi); CCVIter_next(vi)) { + CCVert *v = CCVIter_getCurrent(vi); - ccgdm->vertMap[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))].vert = v; + cgdm->vertMap[GET_INT_FROM_POINTER(CCS_getVertVertHandle(v))].vert = v; } - ccgVertIterator_free(vi); + CCVIter_free(vi); - totedge = ccgSubSurf_getNumEdges(ss); - ccgdm->edgeMap = MEM_mallocN(totedge * sizeof(*ccgdm->edgeMap), "edgeMap"); - ei = ccgSubSurf_getEdgeIterator(ss); - for(; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { - CCGEdge *e = ccgEdgeIterator_getCurrent(ei); + totedge = CCS_getNumEdges(ss); + cgdm->edgeMap = MEM_mallocN(totedge * sizeof(*cgdm->edgeMap), "edgeMap"); + ei = CCS_getEdgeIterator(ss); + for(; !CCEIter_isStopped(ei); CCEIter_next(ei)) { + CCEdge *e = CCEIter_getCurrent(ei); - ccgdm->edgeMap[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e; + cgdm->edgeMap[GET_INT_FROM_POINTER(CCS_getEdgeEdgeHandle(e))].edge = e; } - totface = ccgSubSurf_getNumTessFaces(ss); - ccgdm->faceMap = MEM_mallocN(totface * sizeof(*ccgdm->faceMap), "faceMap"); - fi = ccgSubSurf_getFaceIterator(ss); - for(; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { - CCGFace *f = ccgFaceIterator_getCurrent(fi); + totface = CCS_getNumFaces(ss); + cgdm->faceMap = MEM_mallocN(totface * sizeof(*cgdm->faceMap), "faceMap"); + fi = CCS_getFaceIterator(ss); + for(; !CCFIter_isStopped(fi); CCFIter_next(fi)) { + CCFace *f = CCFIter_getCurrent(fi); - ccgdm->faceMap[GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f))].face = f; + cgdm->faceMap[GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(ss, f))].face = f; } - ccgFaceIterator_free(fi); + CCFIter_free(fi); - edgeSize = ccgSubSurf_getEdgeSize(ss); - gridSize = ccgSubSurf_getGridSize(ss); + edgeSize = CCS_getEdgeSize(ss); + gridSize = CCS_getGridSize(ss); gridFaces = gridSize - 1; gridSideVerts = gridSize - 2; /*gridInternalVerts = gridSideVerts * gridSideVerts; - as yet, unused */ @@ -2608,37 +2618,87 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, medge = dm->getEdgeArray(dm); mface = dm->getTessFaceArray(dm); - vertOrigIndex = DM_get_vert_data_layer(&ccgdm->dm, CD_ORIGINDEX); - /*edgeOrigIndex = DM_get_edge_data_layer(&ccgdm->dm, CD_ORIGINDEX);*/ - faceOrigIndex = DM_get_face_data_layer(&ccgdm->dm, CD_ORIGINDEX); + vertOrigIndex = DM_get_vert_data_layer(&cgdm->dm, CD_ORIGINDEX); + /*edgeOrigIndex = DM_get_edge_data_layer(&cgdm->dm, CD_ORIGINDEX);*/ + faceOrigIndex = DM_get_tessface_data_layer(&cgdm->dm, CD_ORIGINDEX); + faceFlags = DM_get_tessface_data_layer(&cgdm->dm, CD_FLAGS); + + polyOrigIndex = DM_get_face_data_layer(&cgdm->dm, CD_ORIGINDEX); + polyFlags = DM_get_face_data_layer(&cgdm->dm, CD_FLAGS); + + index2 = 0; + dfiter = dm->newFaceIter(dm); + dfiter2 = cgdm->dm.newFaceIter(cgdm); + loopindex = loopindex2 = 0; //current loop index + for (index = 0; index < totface; index++, dfiter->step(dfiter)) { + CCFace *f = cgdm->faceMap[index].face; + int numVerts = CCS_getFaceNumVerts(f); + int numFinalEdges = numVerts * (gridSideEdges + gridInternalEdges); + int mapIndex = cgdm_getFaceMapIndex(ss, f); + int origIndex = GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(ss, f)); + int s, x, y; + + cgdm->faceMap[index].startVert = vertNum; + cgdm->faceMap[index].startEdge = edgeNum; + cgdm->faceMap[index].startFace = faceNum; - faceFlags = DM_get_face_data_layer(&ccgdm->dm, CD_FLAGS); + V_RESET(w); + V_RESET(loopidx); + for (s=0; s<numVerts; s++) { + V_GROW(w); + if (s % 2==0) { + V_GROW(loopidx); + loopidx[s/2] = loopindex++; + } + + w[s] = 1.0f / ((float)numVerts); + } + + /* set the face base vert */ + *((int*)CCS_getFaceUserData(ss, f)) = vertNum; + for (s=0; s<numVerts; s++) { + for (y=0; y<gridFaces; y++) { + for (x=0; x<gridFaces; x++) { + for (i=0; i<4; i++) { + float f1, f2; + + //CustomData_interp(&dm->loopData, &cgdm->dm.loopData, + // loopidx, w, NULL, numVerts/2, loopindex2); + + loopindex2++; + } + + CustomData_interp(&dm->polyData, &cgdm->dm.polyData, &origIndex, w, NULL, 1, index2); + index2++; + } + } + } + } +#if 0 for(index = 0; index < totface; ++index) { - CCGFace *f = ccgdm->faceMap[index].face; - int numVerts = ccgSubSurf_getFaceNumVerts(f); + CCFace *f = cgdm->faceMap[index].face; + int numVerts = CCS_getFaceNumVerts(f); int numFinalEdges = numVerts * (gridSideEdges + gridInternalEdges); - int mapIndex = ccgDM_getFaceMapIndex(ss, f); - int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); + int mapIndex = cgdm_getFaceMapIndex(ss, f); + int origIndex = GET_INT_FROM_POINTER(CCS_getFaceFaceHandle(ss, f)); FaceVertWeight *weight = (numVerts == 4) ? qweight : tweight; int S, x, y; - ccgdm->faceMap[index].startVert = vertNum; - ccgdm->faceMap[index].startEdge = edgeNum; - ccgdm->faceMap[index].startFace = faceNum; + cgdm->faceMap[index].startVert = vertNum; + cgdm->faceMap[index].startEdge = edgeNum; + cgdm->faceMap[index].startFace = faceNum; /* set the face base vert */ - *((int*)ccgSubSurf_getFaceUserData(ss, f)) = vertNum; - - V_RESET(vertIdx); + *((int*)CCS_getFaceUserData(ss, f)) = vertNum; for(S = 0; S < numVerts; S++) { - CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S); + CCVert *v = CCS_getFaceVert(ss, f, S); V_GROW(vertIdx); - vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + vertIdx[S] = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); } - DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, weight[0][0], + DM_interp_vert_data(dm, &cgdm->dm, vertIdx, weight[0][0], numVerts, vertNum); *vertOrigIndex = ORIGINDEX_NONE; ++vertOrigIndex; @@ -2657,7 +2717,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, w[S] = weight[x][0][1]; w[nextS] = weight[x][0][2]; w[otherS] = weight[x][0][3]; - DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w, + DM_interp_vert_data(dm, &cgdm->dm, vertIdx, w, numVerts, vertNum); #endif *vertOrigIndex = ORIGINDEX_NONE; @@ -2678,7 +2738,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, w[S] = weight[y * gridFaces + x][0][1]; w[nextS] = weight[y * gridFaces + x][0][2]; w[otherS] = weight[y * gridFaces + x][0][3]; - DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w, + DM_interp_vert_data(dm, &cgdm->dm, vertIdx, w, numVerts, vertNum); #endif *vertOrigIndex = ORIGINDEX_NONE; @@ -2689,7 +2749,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, } for(i = 0; i < numFinalEdges; ++i) - *(int *)DM_get_edge_data(&ccgdm->dm, edgeNum + i, + *(int *)DM_get_edge_data(&cgdm->dm, edgeNum + i, CD_ORIGINDEX) = ORIGINDEX_NONE; for(S = 0; S < numVerts; S++) { @@ -2712,7 +2772,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, w[j][otherS] = (*weight)[j][3]; } - DM_interp_tessface_data(dm, &ccgdm->dm, &origIndex, NULL, + DM_interp_tessface_data(dm, &cgdm->dm, &origIndex, NULL, &w, 1, faceNum); weight++; #endif @@ -2732,42 +2792,42 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, } if(useSubsurfUv) { - CustomData *fdata = &ccgdm->dm.faceData; + CustomData *fdata = &cgdm->dm.faceData; CustomData *dmfdata = &dm->faceData; int numlayer = CustomData_number_of_layers(fdata, CD_MTFACE); int dmnumlayer = CustomData_number_of_layers(dmfdata, CD_MTFACE); for (i=0; i<numlayer && i<dmnumlayer; i++) - set_subsurf_uv(ss, dm, &ccgdm->dm, i); + set_subsurf_uv(ss, dm, &cgdm->dm, i); } - edgeFlags = DM_get_edge_data_layer(&ccgdm->dm, CD_FLAGS); + edgeFlags = DM_get_edge_data_layer(&cgdm->dm, CD_FLAGS); for(index = 0; index < totedge; ++index) { - CCGEdge *e = ccgdm->edgeMap[index].edge; + CCEdge *e = cgdm->edgeMap[index].edge; int numFinalEdges = edgeSize - 1; - int mapIndex = ccgDM_getEdgeMapIndex(ss, e); + int mapIndex = cgdm_getEdgeMapIndex(ss, e); int x; int vertIdx[2]; - int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e)); + int edgeIdx = GET_INT_FROM_POINTER(CCS_getEdgeEdgeHandle(e)); - CCGVert *v; - v = ccgSubSurf_getEdgeVert0(e); - vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); - v = ccgSubSurf_getEdgeVert1(e); - vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + CCVert *v; + v = CCS_getEdgeVert0(e); + vertIdx[0] = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); + v = CCS_getEdgeVert1(e); + vertIdx[1] = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); - ccgdm->edgeMap[index].startVert = vertNum; - ccgdm->edgeMap[index].startEdge = edgeNum; + cgdm->edgeMap[index].startVert = vertNum; + cgdm->edgeMap[index].startEdge = edgeNum; /* set the edge base vert */ - *((int*)ccgSubSurf_getEdgeUserData(ss, e)) = vertNum; + *((int*)CCS_getEdgeUserData(ss, e)) = vertNum; for(x = 1; x < edgeSize - 1; x++) { float w[2]; w[1] = (float) x / (edgeSize - 1); w[0] = 1 - w[1]; - DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, w, 2, vertNum); + DM_interp_vert_data(dm, &cgdm->dm, vertIdx, w, 2, vertNum); *vertOrigIndex = ORIGINDEX_NONE; ++vertOrigIndex; ++vertNum; @@ -2777,7 +2837,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, if(edgeIdx >= 0 && edgeFlags) edgeFlags[edgeNum + i] = medge[edgeIdx].flag; - *(int *)DM_get_edge_data(&ccgdm->dm, edgeNum + i, + *(int *)DM_get_edge_data(&cgdm->dm, edgeNum + i, CD_ORIGINDEX) = mapIndex; } @@ -2785,18 +2845,18 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, } for(index = 0; index < totvert; ++index) { - CCGVert *v = ccgdm->vertMap[index].vert; - int mapIndex = ccgDM_getVertMapIndex(ccgdm->ss, v); + CCVert *v = cgdm->vertMap[index].vert; + int mapIndex = cgdm_getVertMapIndex(cgdm->ss, v); int vertIdx; - vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + vertIdx = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); - ccgdm->vertMap[index].startVert = vertNum; + cgdm->vertMap[index].startVert = vertNum; /* set the vert base vert */ - *((int*) ccgSubSurf_getVertUserData(ss, v)) = vertNum; + *((int*) CCS_getVertUserData(ss, v)) = vertNum; - DM_copy_vert_data(dm, &ccgdm->dm, vertIdx, vertNum, 1); + DM_copy_vert_data(dm, &cgdm->dm, vertIdx, vertNum, 1); *vertOrigIndex = mapIndex; ++vertOrigIndex; @@ -2807,7 +2867,8 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, MEM_freeN(tweight); V_FREE(vertIdx); - return ccgdm; +#endif + return cgdm; } /***/ @@ -2835,7 +2896,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived_with_multires( useSubsurfUv, dm); } else if(useRenderParams) { /* Do not use cache in render mode. */ - CCGSubSurf *ss; + CSubSurf *ss; int levels; levels= smd->renderLevels; // XXX get_render_subsurf_level(&scene->r, smd->renderLevels); @@ -2849,13 +2910,13 @@ struct DerivedMesh *subsurf_make_derived_from_derived_with_multires( result = ss_to_cdderivedmesh(ss, 0, drawInteriorEdges, useSubsurfUv, dm, ms); - ccgSubSurf_free(ss); + CCS_free(ss); return result; } else { int useIncremental = (smd->flags & eSubsurfModifierFlag_Incremental); int useAging = smd->flags & eSubsurfModifierFlag_DebugIncr; - CCGSubSurf *ss; + CSubSurf *ss; /* It is quite possible there is a much better place to do this. It * depends a bit on how rigourously we expect this function to never @@ -2866,7 +2927,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived_with_multires( * comment that no one will read? Hmmm. - zr */ if(smd->emCache) { - ccgSubSurf_free(smd->emCache); + CCS_free(smd->emCache); smd->emCache = NULL; } @@ -2885,7 +2946,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived_with_multires( useSubsurfUv, dm);*/ } else { if (smd->mCache && isFinalCalc) { - ccgSubSurf_free(smd->mCache); + CCS_free(smd->mCache); smd->mCache = NULL; } @@ -2900,7 +2961,7 @@ struct DerivedMesh *subsurf_make_derived_from_derived_with_multires( result = ss_to_cdderivedmesh(ss, 0, drawInteriorEdges, useSubsurfUv, dm, ms); - ccgSubSurf_free(ss); + CCS_free(ss); return result; } @@ -2923,19 +2984,19 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]) * calculated vert positions is incorrect for the verts * on the boundary of the mesh. */ - CCGSubSurf *ss = _getSubSurf(NULL, 1, 0, 1, 0); + CSubSurf *ss = _getSubSurf(NULL, 1, 0, 1, 0); float edge_sum[3], face_sum[3]; - CCGVertIterator *vi; + CCVertIterator *vi; DerivedMesh *dm = CDDM_from_mesh(me, NULL); ss_sync_from_derivedmesh(ss, dm, NULL, 0); - vi = ccgSubSurf_getVertIterator(ss); - for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { - CCGVert *v = ccgVertIterator_getCurrent(vi); - int idx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); - int N = ccgSubSurf_getVertNumEdges(v); - int numFaces = ccgSubSurf_getVertNumFaces(v); + vi = CCS_getVertIterator(ss); + for (; !CCVIter_isStopped(vi); CCVIter_next(vi)) { + CCVert *v = CCVIter_getCurrent(vi); + int idx = GET_INT_FROM_POINTER(CCS_getVertVertHandle(v)); + int N = CCS_getVertNumEdges(v); + int numFaces = CCS_getVertNumFaces(v); float *co; int i; @@ -2943,12 +3004,12 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]) face_sum[0]= face_sum[1]= face_sum[2]= 0.0; for (i=0; i<N; i++) { - CCGEdge *e = ccgSubSurf_getVertEdge(v, i); - VecAddf(edge_sum, edge_sum, ccgSubSurf_getEdgeData(ss, e, 1)); + CCEdge *e = CCS_getVertEdge(v, i); + VecAddf(edge_sum, edge_sum, CCS_getEdgeData(ss, e, 1)); } for (i=0; i<numFaces; i++) { - CCGFace *f = ccgSubSurf_getVertFace(v, i); - VecAddf(face_sum, face_sum, ccgSubSurf_getFaceCenterData(f)); + CCFace *f = CCS_getVertFace(v, i); + VecAddf(face_sum, face_sum, CCS_getFaceCenterData(f)); } /* ad-hoc correction for boundary vertices, to at least avoid them @@ -2956,14 +3017,14 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]) if(numFaces && numFaces != N) VecMulf(face_sum, (float)N/(float)numFaces); - co = ccgSubSurf_getVertData(ss, v); + co = CCS_getVertData(ss, v); positions_r[idx][0] = (co[0]*N*N + edge_sum[0]*4 + face_sum[0])/(N*(N+5)); positions_r[idx][1] = (co[1]*N*N + edge_sum[1]*4 + face_sum[1])/(N*(N+5)); positions_r[idx][2] = (co[2]*N*N + edge_sum[2]*4 + face_sum[2])/(N*(N+5)); } - ccgVertIterator_free(vi); + CCVIter_free(vi); - ccgSubSurf_free(ss); + CCS_free(ss); dm->release(dm); } diff --git a/source/blender/editors/mesh/bmesh_select.c b/source/blender/editors/mesh/bmesh_select.c index fcc6c23b145..15c9cf68e8f 100644 --- a/source/blender/editors/mesh/bmesh_select.c +++ b/source/blender/editors/mesh/bmesh_select.c @@ -1253,7 +1253,7 @@ void mouse_mesh(bContext *C, short mval[2], short extend) } else if(extend) { EDBM_remove_selection(vc.em, efa); - BM_Select(vc.em->bm, efa, 1); + BM_Select(vc.em->bm, efa, 0); } } else if(eed) { diff --git a/source/blender/editors/mesh/bmesh_tools.c b/source/blender/editors/mesh/bmesh_tools.c index 0b5bfc92dc5..b6aab260261 100644 --- a/source/blender/editors/mesh/bmesh_tools.c +++ b/source/blender/editors/mesh/bmesh_tools.c @@ -153,8 +153,8 @@ void MESH_OT_subdivide(wmOperatorType *ot) RNA_def_float(ot->srna, "smoothness", 0.0f, 0.0f, 1000.0f, "Smoothness", "Smoothness factor.", 0.0f, FLT_MAX); /*props */ - RNA_def_enum(ot->srna, "quadcorner", prop_mesh_cornervert_types, SUBD_INNERVERT, "Quad Corner Type", "Method used for subdividing two adjacent edges in a quad"); - RNA_def_boolean(ot->srna, "tess_single_edge", 1, "Tesselate Single Edge", "Adds triangles to single edges belonging to triangles or quads"); + RNA_def_enum(ot->srna, "quadcorner", prop_mesh_cornervert_types, SUBD_STRAIGHT_CUT, "Quad Corner Type", "Method used for subdividing two adjacent edges in a quad"); + RNA_def_boolean(ot->srna, "tess_single_edge", 0, "Tesselate Single Edge", "Adds triangles to single edges belonging to triangles or quads"); RNA_def_boolean(ot->srna, "gridfill", 1, "Grid Fill", "Fill Fully Selected Triangles and Quads With A Grid"); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 462a942dce9..486ffb3d178 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -1370,12 +1370,14 @@ void mesh_foreachScreenEdge(ViewContext *vc, void (*func)(void *userData, BMEdge static void mesh_foreachScreenFace__mapFunc(void *userData, int index, float *cent, float *no) { struct { void (*func)(void *userData, BMFace *efa, int x, int y, int index); void *userData; ViewContext vc; float pmat[4][4], vmat[4][4]; } *data = userData; + float cent2[3]; BMFace *efa = EDBM_get_face_for_index(data->vc.em, index); short s[2]; + VECCOPY(cent2, cent); if (efa && !BM_TestHFlag(efa, BM_HIDDEN)) { - MTC_Mat4MulVecfl(data->vc.obedit->obmat, cent); - project_short(data->vc.ar, cent, s); + MTC_Mat4MulVecfl(data->vc.obedit->obmat, cent2); + project_short(data->vc.ar, cent2, s); data->func(data->userData, efa, s[0], s[1], index); } |