diff options
Diffstat (limited to 'source/blender/blenkernel/intern/subsurf_ccg.c')
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 204 |
1 files changed, 101 insertions, 103 deletions
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index e6797186b53..f79009e673d 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -86,9 +86,9 @@ struct CCGDerivedMesh { typedef struct CCGDerivedMesh CCGDerivedMesh; -static int ccgDM_getVertMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGVert *v); -static int ccgDM_getEdgeMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGEdge *e); -static int ccgDM_getFaceMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGFace *f); +static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v); +static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e); +static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f); /// @@ -161,8 +161,8 @@ static CCGSubSurf *_getSubSurf(CCGSubSurf *prevSS, int subdivLevels, int useAgin } static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize) { - CCGVert *v0 = ccgSubSurf_getEdgeVert0(ss, e); - CCGVert *v1 = ccgSubSurf_getEdgeVert1(ss, e); + 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)); @@ -177,7 +177,7 @@ static int getEdgeIndex(CCGSubSurf *ss, CCGEdge *e, int x, int edgeSize) { } 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(ss, f); + int numVerts = ccgSubSurf_getFaceNumVerts(f); if (x==gridSize-1 && y==gridSize-1) { CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S); @@ -186,7 +186,7 @@ static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edg 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(ss, e)) { + if (v==ccgSubSurf_getEdgeVert0(e)) { return edgeBase + (gridSize-1-y)-1; } else { return edgeBase + (edgeSize-2-1)-((gridSize-1-y)-1); @@ -195,7 +195,7 @@ static int getFaceIndex(CCGSubSurf *ss, CCGFace *f, int S, int x, int y, int edg 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(ss, e)) { + if (v==ccgSubSurf_getEdgeVert0(e)) { return edgeBase + (gridSize-1-x)-1; } else { return edgeBase + (edgeSize-2-1)-((gridSize-1-x)-1); @@ -300,7 +300,7 @@ static int ss_sync_from_uv(CCGSubSurf *ss, CCGSubSurf *origss, DerivedMesh *dm, if ((mv0->flag&mv1->flag) & ME_VERT_MERGED) crease = creaseFactor; else - crease = ccgSubSurf_getEdgeCrease(origss, orige); + crease = ccgSubSurf_getEdgeCrease(orige); ccgSubSurf_syncEdge(ss, ehdl, fverts[j], fverts[(j+1)%nverts], crease, &e); BLI_edgehash_insert(ehash, v0, v1, NULL); @@ -368,7 +368,7 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result, for(index = 0; index < totface; index++) { CCGFace *f = faceMap[index]; - int numVerts = ccgSubSurf_getFaceNumVerts(uvss, f); + int numVerts = ccgSubSurf_getFaceNumVerts(f); for (S=0; S<numVerts; S++) { VertData *faceGridData= ccgSubSurf_getFaceGridDataArray(uvss, f, S); @@ -399,12 +399,12 @@ static void set_subsurf_uv(CCGSubSurf *ss, DerivedMesh *dm, DerivedMesh *result, static unsigned int ss_getEdgeFlags(CCGSubSurf *ss, CCGEdge *e, int ssFromEditmesh, DispListMesh *dlm, MEdge *medge, MTFace *tface) { unsigned int flags = 0; - int N = ccgSubSurf_getEdgeNumFaces(ss, e); + int N = ccgSubSurf_getEdgeNumFaces(e); if (!N) flags |= ME_LOOSEEDGE; if (ssFromEditmesh) { - EditEdge *eed = ccgSubSurf_getEdgeEdgeHandle(ss, e); + EditEdge *eed = ccgSubSurf_getEdgeEdgeHandle(e); flags |= ME_EDGEDRAW|ME_EDGERENDER; if (eed->seam) { @@ -470,7 +470,7 @@ static void calc_ss_weights(int gridFaces, } } -DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, +static DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, int drawInteriorEdges, int useSubsurfUv, DerivedMesh *dm) { @@ -480,7 +480,6 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, int gridFaces = gridSize - 1; int edgeBase, faceBase; int i, j, k, S, x, y, index; - int vertBase = 0; CCGVertIterator *vi; CCGEdgeIterator *ei; CCGFaceIterator *fi; @@ -503,7 +502,7 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, for(; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { CCGVert *v = ccgVertIterator_getCurrent(vi); - vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v))] = v; + vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))] = v; } ccgVertIterator_free(vi); @@ -513,7 +512,7 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, for(; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e))] = e; + edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))] = e; } totface = ccgSubSurf_getNumFaces(ss); @@ -543,18 +542,18 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, for(index = 0; index < totface; index++) { CCGFace *f = faceMap2[index]; - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); FaceVertWeight *weight = (numVerts == 4) ? qweight : tweight; int vertIdx[4]; for(S = 0; S < numVerts; S++) { CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S); - vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v)); + vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); } DM_interp_vert_data(dm, result, vertIdx, weight[0][0], numVerts, i); - VecCopyf(mvert->co, ccgSubSurf_getFaceCenterData(ss, f)); + VecCopyf(mvert->co, ccgSubSurf_getFaceCenterData(f)); *origIndex = ORIGINDEX_NONE; ++mvert; ++origIndex; @@ -613,10 +612,10 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, int vertIdx[2]; CCGVert *v; - v = ccgSubSurf_getEdgeVert0(ss, e); - vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v)); - v = ccgSubSurf_getEdgeVert1(ss, e); - vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, 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)); for(x = 1; x < edgeSize - 1; x++) { float w[2]; @@ -634,18 +633,17 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, edgeBase += edgeSize-2; } - vertBase = i; for(index = 0; index < totvert; index++) { CCGVert *v = vertMap2[index]; int vertIdx; - vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v)); + vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); DM_copy_vert_data(dm, result, vertIdx, i, 1); VecCopyf(mvert->co, ccgSubSurf_getVertData(ss, v)); *((int*)ccgSubSurf_getVertUserData(ss, v)) = i; - *origIndex = ccgDM_getVertMapIndex(NULL, ss, v); + *origIndex = ccgDM_getVertMapIndex(ss, v); ++mvert; ++origIndex; i++; @@ -658,7 +656,7 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, for(index = 0; index < totface; index++) { CCGFace *f = faceMap2[index]; - int numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int numVerts = ccgSubSurf_getFaceNumVerts(f); for(k = 0; k < numVerts; k++) { for(x = 0; x < gridFaces; x++) { @@ -701,9 +699,9 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, CCGEdge *e = edgeMap2[index]; unsigned int flags = 0; char bweight = 0; - int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e)); + int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e)); - if(!ccgSubSurf_getEdgeNumFaces(ss, e)) flags |= ME_LOOSEEDGE; + if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE; if(edgeIdx != -1 && dm) { @@ -719,7 +717,7 @@ 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(NULL, ss, e); + *origIndex = ccgDM_getEdgeMapIndex(ss, e); ++med; ++origIndex; i++; @@ -733,10 +731,10 @@ DerivedMesh *ss_to_cdderivedmesh(CCGSubSurf *ss, int ssFromEditmesh, for(index = 0; index < totface; index++) { CCGFace *f = faceMap2[index]; - int numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int numVerts = ccgSubSurf_getFaceNumVerts(f); int mat_nr; int flag; - int mapIndex = ccgDM_getFaceMapIndex(NULL, ss, f); + int mapIndex = ccgDM_getFaceMapIndex(ss, f); int faceIdx = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); if(!ssFromEditmesh) { @@ -900,15 +898,15 @@ static void ss_sync_from_derivedmesh(CCGSubSurf *ss, DerivedMesh *dm, /***/ -static int ccgDM_getVertMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGVert *v) { +static int ccgDM_getVertMapIndex(CCGSubSurf *ss, CCGVert *v) { return ((int*) ccgSubSurf_getVertUserData(ss, v))[1]; } -static int ccgDM_getEdgeMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGEdge *e) { +static int ccgDM_getEdgeMapIndex(CCGSubSurf *ss, CCGEdge *e) { return ((int*) ccgSubSurf_getEdgeUserData(ss, e))[1]; } -static int ccgDM_getFaceMapIndex(CCGDerivedMesh *ccgdm, CCGSubSurf *ss, CCGFace *f) { +static int ccgDM_getFaceMapIndex(CCGSubSurf *ss, CCGFace *f) { return ((int*) ccgSubSurf_getFaceUserData(ss, f))[1]; } @@ -941,7 +939,7 @@ static void ccgDM_getMinMax(DerivedMesh *dm, float min_r[3], float max_r[3]) { for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); for (S=0; S<numVerts; S++) { VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); @@ -997,7 +995,7 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv) ++i; f = ccgdm->faceMap[i].face; - numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + numVerts = ccgSubSurf_getFaceNumVerts(f); gridSideVerts = gridSize - 2; gridInternalVerts = gridSideVerts * gridSideVerts; @@ -1007,7 +1005,7 @@ static void ccgDM_getFinalVert(DerivedMesh *dm, int vertNum, MVert *mv) offset = vertNum - ccgdm->faceMap[i].startVert; if(offset < 1) { - VecCopyf(mv->co, ccgSubSurf_getFaceCenterData(ss, f)); + VecCopyf(mv->co, ccgSubSurf_getFaceCenterData(f)); } else if(offset < gridSideEnd) { offset -= 1; grid = offset / gridSideVerts; @@ -1069,7 +1067,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med) ++i; f = ccgdm->faceMap[i].face; - numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + numVerts = ccgSubSurf_getFaceNumVerts(f); gridSideEdges = gridSize - 1; gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2; @@ -1105,7 +1103,7 @@ static void ccgDM_getFinalEdge(DerivedMesh *dm, int edgeNum, MEdge *med) e = ccgdm->edgeMap[i].edge; - if(!ccgSubSurf_getEdgeNumFaces(ss, e)) flags |= ME_LOOSEEDGE; + if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE; x = edgeNum - ccgdm->edgeMap[i].startEdge; @@ -1147,7 +1145,7 @@ static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf) ++i; f = ccgdm->faceMap[i].face; - numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + numVerts = ccgSubSurf_getFaceNumVerts(f); offset = faceNum - ccgdm->faceMap[i].startFace; grid = offset / gridFaces; @@ -1177,9 +1175,9 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) totface = ccgSubSurf_getNumFaces(ss); for(index = 0; index < totface; index++) { CCGFace *f = ccgdm->faceMap[index].face; - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); - VecCopyf(mvert[i++].co, ccgSubSurf_getFaceCenterData(ss, f)); + VecCopyf(mvert[i++].co, ccgSubSurf_getFaceCenterData(f)); for(S = 0; S < numVerts; S++) { for(x = 1; x < gridSize - 1; x++) { @@ -1232,7 +1230,7 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) totface = ccgSubSurf_getNumFaces(ss); for(index = 0; index < totface; index++) { CCGFace *f = ccgdm->faceMap[index].face; - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); for(S = 0; S < numVerts; S++) { for(x = 0; x < gridSize - 1; x++) { @@ -1276,9 +1274,9 @@ static void ccgDM_copyFinalEdgeArray(DerivedMesh *dm, MEdge *medge) CCGEdge *e = ccgdm->edgeMap[index].edge; unsigned int flags = 0; int x; - int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e)); + int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e)); - if(!ccgSubSurf_getEdgeNumFaces(ss, e)) flags |= ME_LOOSEEDGE; + if(!ccgSubSurf_getEdgeNumFaces(e)) flags |= ME_LOOSEEDGE; if(edgeFlags) { if(edgeIdx != -1) { @@ -1313,7 +1311,7 @@ static void ccgDM_copyFinalFaceArray(DerivedMesh *dm, MFace *mface) totface = ccgSubSurf_getNumFaces(ss); for(index = 0; index < totface; index++) { CCGFace *f = ccgdm->faceMap[index].face; - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); int mat_nr = 0; int flag = ME_SMOOTH; /* assume face is smooth by default */ @@ -1360,7 +1358,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) { for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { CCGVert *v = ccgVertIterator_getCurrent(vi); - vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v))] = v; + vertMap2[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))] = v; } ccgVertIterator_free(vi); @@ -1370,7 +1368,7 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) { for (i=0; !ccgEdgeIterator_isStopped(ei); i++,ccgEdgeIterator_next(ei)) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e))] = e; + edgeMap2[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))] = e; } totface = ccgSubSurf_getNumFaces(ss); @@ -1386,9 +1384,9 @@ static void ccgdm_getVertCos(DerivedMesh *dm, float (*cos)[3]) { i = 0; for (index=0; index<totface; index++) { CCGFace *f = faceMap2[index]; - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); - VecCopyf(cos[i++], ccgSubSurf_getFaceCenterData(ss, f)); + VecCopyf(cos[i++], ccgSubSurf_getFaceCenterData(f)); for (S=0; S<numVerts; S++) { for (x=1; x<gridSize-1; x++) { @@ -1430,7 +1428,7 @@ static void ccgDM_foreachMappedVert(DerivedMesh *dm, void (*func)(void *userData for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { CCGVert *v = ccgVertIterator_getCurrent(vi); VertData *vd = ccgSubSurf_getVertData(ccgdm->ss, v); - int index = ccgDM_getVertMapIndex(ccgdm, ccgdm->ss, v); + int index = ccgDM_getVertMapIndex(ccgdm->ss, v); if (index!=-1) func(userData, index, vd->co, vd->no, NULL); @@ -1447,7 +1445,7 @@ static void ccgDM_foreachMappedEdge(DerivedMesh *dm, void (*func)(void *userData for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - int index = ccgDM_getEdgeMapIndex(ccgdm, ss, e); + int index = ccgDM_getEdgeMapIndex(ss, e); if (index!=-1) { for (i=0; i<edgeSize-1; i++) @@ -1488,9 +1486,9 @@ static void ccgDM_drawVerts(DerivedMesh *dm) { fi = ccgSubSurf_getFaceIterator(ss); for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { CCGFace *f = ccgFaceIterator_getCurrent(fi); - int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int x, y, S, numVerts = ccgSubSurf_getFaceNumVerts(f); - glVertex3fv(ccgSubSurf_getFaceCenterData(ss, f)); + glVertex3fv(ccgSubSurf_getFaceCenterData(f)); for (S=0; S<numVerts; S++) for (x=1; x<gridSize-1; x++) glVertex3fv(ccgSubSurf_getFaceGridEdgeData(ss, f, S, x)); @@ -1517,7 +1515,7 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(ss, e)) + if (!drawLooseEdges && !ccgSubSurf_getEdgeNumFaces(e)) continue; if (useAging && !(G.f&G_BACKBUFSEL)) { @@ -1540,7 +1538,7 @@ static void ccgDM_drawEdges(DerivedMesh *dm, int drawLooseEdges) { if (ccgdm->drawInteriorEdges) { for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); for (S=0; S<numVerts; S++) { VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); @@ -1578,7 +1576,7 @@ static void ccgDM_drawLooseEdges(DerivedMesh *dm) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - if (!ccgSubSurf_getEdgeNumFaces(ss, e)) { + if (!ccgSubSurf_getEdgeNumFaces(e)) { glBegin(GL_LINE_STRIP); for (i=0; i<edgeSize-1; i++) { glVertex3fv(edgeData[i].co); @@ -1615,7 +1613,7 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, int (*setMaterial)(int, void * for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); int drawSmooth, mat_nr; @@ -1723,9 +1721,9 @@ static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, v CCGFace *f = ccgdm->faceMap[i].face; int S, x, y, drawSmooth; int index = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); - int origIndex = ccgDM_getFaceMapIndex(ccgdm, ss, f); + int origIndex = ccgDM_getFaceMapIndex(ss, f); - numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + numVerts = ccgSubSurf_getFaceNumVerts(f); if(faceFlags) { drawSmooth = (faceFlags[index*4] & ME_SMOOTH); @@ -1858,7 +1856,7 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned ch glBegin(GL_QUADS); for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); for (S=0; S<numVerts; S++) { VertData *faceGridData = ccgSubSurf_getFaceGridDataArray(ss, f, S); @@ -1916,8 +1914,8 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, totface = ccgSubSurf_getNumFaces(ss); for(i = 0; i < totface; i++) { CCGFace *f = ccgdm->faceMap[i].face; - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); - int drawSmooth, index = ccgDM_getFaceMapIndex(ccgdm, ss, f); + 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)); unsigned char *cp= NULL; int mat_nr; @@ -1999,28 +1997,28 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, glBegin(GL_QUADS); for (y=0; y<gridFaces; y++) { for (x=0; x<gridFaces; x++) { - float *a = faceGridData[(y+0)*gridSize + x].co; - float *b = faceGridData[(y+0)*gridSize + x + 1].co; - float *c = faceGridData[(y+1)*gridSize + x + 1].co; - float *d = faceGridData[(y+1)*gridSize + x].co; + float *a_co = faceGridData[(y+0)*gridSize + x].co; + float *b_co = faceGridData[(y+0)*gridSize + x + 1].co; + float *c_co = faceGridData[(y+1)*gridSize + x + 1].co; + float *d_co = faceGridData[(y+1)*gridSize + x].co; - ccgDM_glNormalFast(a, b, c, d); + ccgDM_glNormalFast(a_co, b_co, c_co, d_co); if(tf) glTexCoord2fv(tf->uv[1]); if(cp) glColor3ub(cp[7], cp[6], cp[5]); - glVertex3fv(d); + glVertex3fv(d_co); if(tf) glTexCoord2fv(tf->uv[2]); if(cp) glColor3ub(cp[11], cp[10], cp[9]); - glVertex3fv(c); + glVertex3fv(c_co); if(tf) glTexCoord2fv(tf->uv[3]); if(cp) glColor3ub(cp[15], cp[14], cp[13]); - glVertex3fv(b); + glVertex3fv(b_co); if(tf) glTexCoord2fv(tf->uv[0]); if(cp) glColor3ub(cp[3], cp[2], cp[1]); - glVertex3fv(a); + glVertex3fv(a_co); if(tf) tf++; if(cp) cp += 16; @@ -2084,8 +2082,8 @@ static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *u for (i=0; !ccgFaceIterator_isStopped(fi); i++,ccgFaceIterator_next(fi)) { CCGFace *f = ccgFaceIterator_getCurrent(fi); - int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(ss, f); - int drawSmooth, index = ccgDM_getFaceMapIndex(ccgdm, ss, f); + int S, x, y, numVerts = ccgSubSurf_getFaceNumVerts(f); + int drawSmooth, index = ccgDM_getFaceMapIndex(ss, f); int origIndex; origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); @@ -2166,7 +2164,7 @@ static void ccgDM_drawMappedEdges(DerivedMesh *dm, int (*setDrawOptions)(void *u for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - int index = ccgDM_getEdgeMapIndex(ccgdm, ss, e); + int index = ccgDM_getEdgeMapIndex(ss, e); glBegin(GL_LINE_STRIP); if (index!=-1 && (!setDrawOptions || setDrawOptions(userData, index))) { @@ -2196,7 +2194,7 @@ static void ccgDM_drawMappedEdgesInterp(DerivedMesh *dm, int (*setDrawOptions)(v for (; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); VertData *edgeData = ccgSubSurf_getEdgeDataArray(ss, e); - int index = ccgDM_getEdgeMapIndex(ccgdm, ss, e); + int index = ccgDM_getEdgeMapIndex(ss, e); glBegin(GL_LINE_STRIP); if (index!=-1 && (!setDrawOptions || setDrawOptions(userData, index))) { @@ -2223,7 +2221,7 @@ static void ccgDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *us for (; !ccgFaceIterator_isStopped(fi); ccgFaceIterator_next(fi)) { CCGFace *f = ccgFaceIterator_getCurrent(fi); - int index = ccgDM_getFaceMapIndex(ccgdm, ss, f); + int index = ccgDM_getFaceMapIndex(ss, f); if (index!=-1) { /* Face center data normal isn't updated atm. */ @@ -2259,17 +2257,17 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, int index, totvert, totedge, totface; int i; int vertNum, edgeNum, faceNum; - int *vertOrigIndex, *edgeOrigIndex, *faceOrigIndex; + int *vertOrigIndex, *faceOrigIndex; /* *edgeOrigIndex - as yet, unused */ int *edgeFlags; char *faceFlags; int edgeSize; int gridSize; int gridFaces; int gridSideVerts; - int gridInternalVerts; + /*int gridInternalVerts; - as yet unused */ int gridSideEdges; int gridInternalEdges; - MVert *mvert = NULL; + /* MVert *mvert = NULL; - as yet unused */ MEdge *medge = NULL; MFace *mface = NULL; FaceVertWeight *qweight, *tweight; @@ -2333,7 +2331,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, for(; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { CCGVert *v = ccgVertIterator_getCurrent(vi); - ccgdm->vertMap[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v))].vert = v; + ccgdm->vertMap[GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v))].vert = v; } ccgVertIterator_free(vi); @@ -2343,7 +2341,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, for(; !ccgEdgeIterator_isStopped(ei); ccgEdgeIterator_next(ei)) { CCGEdge *e = ccgEdgeIterator_getCurrent(ei); - ccgdm->edgeMap[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e))].edge = e; + ccgdm->edgeMap[GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e))].edge = e; } totface = ccgSubSurf_getNumFaces(ss); @@ -2360,7 +2358,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, gridSize = ccgSubSurf_getGridSize(ss); gridFaces = gridSize - 1; gridSideVerts = gridSize - 2; - gridInternalVerts = gridSideVerts * gridSideVerts; + /*gridInternalVerts = gridSideVerts * gridSideVerts; - as yet, unused */ gridSideEdges = gridSize - 1; gridInternalEdges = (gridSideEdges - 1) * gridSideEdges * 2; @@ -2370,21 +2368,21 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, edgeNum = 0; faceNum = 0; - mvert = dm->getVertArray(dm); + /* mvert = dm->getVertArray(dm); - as yet unused */ medge = dm->getEdgeArray(dm); mface = dm->getFaceArray(dm); vertOrigIndex = DM_get_vert_data_layer(&ccgdm->dm, CD_ORIGINDEX); - edgeOrigIndex = DM_get_edge_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); faceFlags = DM_get_face_data_layer(&ccgdm->dm, CD_FLAGS); for(index = 0; index < totface; ++index) { CCGFace *f = ccgdm->faceMap[index].face; - int numVerts = ccgSubSurf_getFaceNumVerts(ss, f); + int numVerts = ccgSubSurf_getFaceNumVerts(f); int numFinalEdges = numVerts * (gridSideEdges + gridInternalEdges); - int mapIndex = ccgDM_getFaceMapIndex(ccgdm, ss, f); + int mapIndex = ccgDM_getFaceMapIndex(ss, f); int origIndex = GET_INT_FROM_POINTER(ccgSubSurf_getFaceFaceHandle(ss, f)); FaceVertWeight *weight = (numVerts == 4) ? qweight : tweight; int S, x, y; @@ -2400,7 +2398,7 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, for(S = 0; S < numVerts; S++) { CCGVert *v = ccgSubSurf_getFaceVert(ss, f, S); - vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v)); + vertIdx[S] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); } DM_interp_vert_data(dm, &ccgdm->dm, vertIdx, weight[0][0], @@ -2503,16 +2501,16 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, for(index = 0; index < totedge; ++index) { CCGEdge *e = ccgdm->edgeMap[index].edge; int numFinalEdges = edgeSize - 1; - int mapIndex = ccgDM_getEdgeMapIndex(ccgdm, ss, e); + int mapIndex = ccgDM_getEdgeMapIndex(ss, e); int x; int vertIdx[2]; - int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(ss, e)); + int edgeIdx = GET_INT_FROM_POINTER(ccgSubSurf_getEdgeEdgeHandle(e)); CCGVert *v; - v = ccgSubSurf_getEdgeVert0(ss, e); - vertIdx[0] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v)); - v = ccgSubSurf_getEdgeVert1(ss, e); - vertIdx[1] = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, 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)); ccgdm->edgeMap[index].startVert = vertNum; ccgdm->edgeMap[index].startEdge = edgeNum; @@ -2543,10 +2541,10 @@ static CCGDerivedMesh *getCCGDerivedMesh(CCGSubSurf *ss, for(index = 0; index < totvert; ++index) { CCGVert *v = ccgdm->vertMap[index].vert; - int mapIndex = ccgDM_getVertMapIndex(ccgdm, ccgdm->ss, v); + int mapIndex = ccgDM_getVertMapIndex(ccgdm->ss, v); int vertIdx; - vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v)); + vertIdx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); ccgdm->vertMap[index].startVert = vertNum; @@ -2679,9 +2677,9 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3]) vi = ccgSubSurf_getVertIterator(ss); for (; !ccgVertIterator_isStopped(vi); ccgVertIterator_next(vi)) { CCGVert *v = ccgVertIterator_getCurrent(vi); - int idx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(ss, v)); - int N = ccgSubSurf_getVertNumEdges(ss, v); - int numFaces = ccgSubSurf_getVertNumFaces(ss, v); + int idx = GET_INT_FROM_POINTER(ccgSubSurf_getVertVertHandle(v)); + int N = ccgSubSurf_getVertNumEdges(v); + int numFaces = ccgSubSurf_getVertNumFaces(v); float *co; int i; @@ -2689,12 +2687,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(ss, v, i); + CCGEdge *e = ccgSubSurf_getVertEdge(v, i); VecAddf(edge_sum, edge_sum, ccgSubSurf_getEdgeData(ss, e, 1)); } for (i=0; i<numFaces; i++) { - CCGFace *f = ccgSubSurf_getVertFace(ss, v, i); - VecAddf(face_sum, face_sum, ccgSubSurf_getFaceCenterData(ss, f)); + CCGFace *f = ccgSubSurf_getVertFace(v, i); + VecAddf(face_sum, face_sum, ccgSubSurf_getFaceCenterData(f)); } /* ad-hoc correction for boundary vertices, to at least avoid them |