From b340f930ec5639f24e7e2d47fab221fb752b61dd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 28 Apr 2012 06:31:57 +0000 Subject: style cleanup: changes to brace placement / newlines - for/while/if/switch --- intern/mikktspace/mikktspace.c | 406 ++++++++++++++++++++--------------------- 1 file changed, 203 insertions(+), 203 deletions(-) (limited to 'intern/mikktspace') diff --git a/intern/mikktspace/mikktspace.c b/intern/mikktspace/mikktspace.c index 2036e601bcb..24c77c439a7 100644 --- a/intern/mikktspace/mikktspace.c +++ b/intern/mikktspace/mikktspace.c @@ -193,7 +193,7 @@ static STSpace AvgTSpace(const STSpace * pTS0, const STSpace * pTS1) // this if is important. Due to floating point precision // averaging when ts0==ts1 will cause a slight difference // which results in tangent space splits later on - if(pTS0->fMagS==pTS1->fMagS && pTS0->fMagT==pTS1->fMagT && + if (pTS0->fMagS==pTS1->fMagS && pTS0->fMagT==pTS1->fMagT && veq(pTS0->vOs,pTS1->vOs) && veq(pTS0->vOt, pTS1->vOt)) { ts_res.fMagS = pTS0->fMagS; @@ -207,8 +207,8 @@ static STSpace AvgTSpace(const STSpace * pTS0, const STSpace * pTS1) ts_res.fMagT = 0.5f*(pTS0->fMagT+pTS1->fMagT); ts_res.vOs = vadd(pTS0->vOs,pTS1->vOs); ts_res.vOt = vadd(pTS0->vOt,pTS1->vOt); - if( VNotZero(ts_res.vOs) ) ts_res.vOs = Normalize(ts_res.vOs); - if( VNotZero(ts_res.vOt) ) ts_res.vOt = Normalize(ts_res.vOt); + if ( VNotZero(ts_res.vOs) ) ts_res.vOs = Normalize(ts_res.vOs); + if ( VNotZero(ts_res.vOt) ) ts_res.vOt = Normalize(ts_res.vOt); } return ts_res; @@ -246,7 +246,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre const float fThresCos = (float) cos((fAngularThreshold*(float)M_PI)/180.0f); // verify all call-backs have been set - if( pContext->m_pInterface->m_getNumFaces==NULL || + if ( pContext->m_pInterface->m_getNumFaces==NULL || pContext->m_pInterface->m_getNumVerticesOfFace==NULL || pContext->m_pInterface->m_getPosition==NULL || pContext->m_pInterface->m_getNormal==NULL || @@ -254,21 +254,21 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre return TFALSE; // count triangles on supported faces - for(f=0; fm_pInterface->m_getNumVerticesOfFace(pContext, f); - if(verts==3) ++iNrTrianglesIn; + if (verts==3) ++iNrTrianglesIn; else if(verts==4) iNrTrianglesIn += 2; } - if(iNrTrianglesIn<=0) return TFALSE; + if (iNrTrianglesIn<=0) return TFALSE; // allocate memory for an index list piTriListIn = (int *) malloc(sizeof(int)*3*iNrTrianglesIn); pTriInfos = (STriInfo *) malloc(sizeof(STriInfo)*iNrTrianglesIn); - if(piTriListIn==NULL || pTriInfos==NULL) + if (piTriListIn==NULL || pTriInfos==NULL) { - if(piTriListIn!=NULL) free(piTriListIn); - if(pTriInfos!=NULL) free(pTriInfos); + if (piTriListIn!=NULL) free(piTriListIn); + if (pTriInfos!=NULL) free(pTriInfos); return TFALSE; } @@ -283,7 +283,7 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre // Mark all degenerate triangles iTotTris = iNrTrianglesIn; iDegenTriangles = 0; - for(t=0; tm_pInterface->m_getNumVerticesOfFace(pContext, f); - if(verts!=3 && verts!=4) continue; + if (verts!=3 && verts!=4) continue; // I've decided to let degenerate triangles and group-with-anythings @@ -390,28 +390,28 @@ tbool genTangSpace(const SMikkTSpaceContext * pContext, const float fAngularThre // (this is already the case for good triangles but not for // degenerate ones and those with bGroupWithAnything==true) bool bOrient = psTspace[index].bOrient; - if(psTspace[index].iCounter == 0) // tspace was not derived from a group + if (psTspace[index].iCounter == 0) // tspace was not derived from a group { // look for a space created in GenerateTSpaces() by iCounter>0 bool bNotFound = true; int i=1; - while(i 0) bNotFound=false; + if (psTspace[index+i].iCounter > 0) bNotFound=false; else ++i; } - if(!bNotFound) bOrient = psTspace[index+i].bOrient; + if (!bNotFound) bOrient = psTspace[index+i].bOrient; }*/ // set data - for(i=0; ivOs.x, pTSpace->vOs.y, pTSpace->vOs.z}; float bitang[] = {pTSpace->vOt.x, pTSpace->vOt.y, pTSpace->vOt.z}; - if(pContext->m_pInterface->m_setTSpace!=NULL) + if (pContext->m_pInterface->m_setTSpace!=NULL) pContext->m_pInterface->m_setTSpace(pContext, tang, bitang, pTSpace->fMagS, pTSpace->fMagT, pTSpace->bOrient, f, i); - if(pContext->m_pInterface->m_setTSpaceBasic!=NULL) + if (pContext->m_pInterface->m_setTSpaceBasic!=NULL) pContext->m_pInterface->m_setTSpaceBasic(pContext, tang, pTSpace->bOrient==TTRUE ? 1.0f : (-1.0f), f, i); ++index; @@ -464,23 +464,23 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM int iMaxCount=0; SVec3 vMin = GetPosition(pContext, 0), vMax = vMin, vDim; float fMin, fMax; - for(i=1; i<(iNrTrianglesIn*3); i++) + for (i=1; i<(iNrTrianglesIn*3); i++) { const int index = piTriList_in_and_out[i]; const SVec3 vP = GetPosition(pContext, index); - if(vMin.x > vP.x) vMin.x = vP.x; + if (vMin.x > vP.x) vMin.x = vP.x; else if(vMax.x < vP.x) vMax.x = vP.x; - if(vMin.y > vP.y) vMin.y = vP.y; + if (vMin.y > vP.y) vMin.y = vP.y; else if(vMax.y < vP.y) vMax.y = vP.y; - if(vMin.z > vP.z) vMin.z = vP.z; + if (vMin.z > vP.z) vMin.z = vP.z; else if(vMax.z < vP.z) vMax.z = vP.z; } vDim = vsub(vMax,vMin); iChannel = 0; fMin = vMin.x; fMax=vMax.x; - if(vDim.y>vDim.x && vDim.y>vDim.z) + if (vDim.y>vDim.x && vDim.y>vDim.z) { iChannel=1; fMin = vMin.y, fMax=vMax.y; @@ -497,12 +497,12 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM piHashOffsets = (int *) malloc(sizeof(int)*g_iCells); piHashCount2 = (int *) malloc(sizeof(int)*g_iCells); - if(piHashTable==NULL || piHashCount==NULL || piHashOffsets==NULL || piHashCount2==NULL) + if (piHashTable==NULL || piHashCount==NULL || piHashOffsets==NULL || piHashCount2==NULL) { - if(piHashTable!=NULL) free(piHashTable); - if(piHashCount!=NULL) free(piHashCount); - if(piHashOffsets!=NULL) free(piHashOffsets); - if(piHashCount2!=NULL) free(piHashCount2); + if (piHashTable!=NULL) free(piHashTable); + if (piHashCount!=NULL) free(piHashCount); + if (piHashOffsets!=NULL) free(piHashOffsets); + if (piHashCount2!=NULL) free(piHashCount2); GenerateSharedVerticesIndexListSlow(piTriList_in_and_out, pContext, iNrTrianglesIn); return; } @@ -510,7 +510,7 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM memset(piHashCount2, 0, sizeof(int)*g_iCells); // count amount of elements in each cell unit - for(i=0; i<(iNrTrianglesIn*3); i++) + for (i=0; i<(iNrTrianglesIn*3); i++) { const int index = piTriList_in_and_out[i]; const SVec3 vP = GetPosition(pContext, index); @@ -521,11 +521,11 @@ static void GenerateSharedVerticesIndexList(int piTriList_in_and_out[], const SM // evaluate start index of each cell. piHashOffsets[0]=0; - for(k=1; kpTmpVert[l].vert[c]) fvMin[c]=pTmpVert[l].vert[c]; + for (l=(iL_in+1); l<=iR_in; l++) + for (c=0; c<3; c++) + if (fvMin[c]>pTmpVert[l].vert[c]) fvMin[c]=pTmpVert[l].vert[c]; else if(fvMax[c]dx && dy>dz) channel=1; + if (dy>dx && dy>dz) channel=1; else if(dz>dx) channel=2; fSep = 0.5f*(fvMax[channel]+fvMin[channel]); // terminate recursion when the separation/average value // is no longer strictly between fMin and fMax values. - if(fSep>=fvMax[channel] || fSep<=fvMin[channel]) + if (fSep>=fvMax[channel] || fSep<=fvMin[channel]) { // complete the weld - for(l=iL_in; l<=iR_in; l++) + for (l=iL_in; l<=iR_in; l++) { int i = pTmpVert[l].index; const int index = piTriList_in_and_out[i]; @@ -617,7 +617,7 @@ static void MergeVertsFast(int piTriList_in_and_out[], STmpVert pTmpVert[], cons tbool bNotFound = TTRUE; int l2=iL_in, i2rec=-1; - while(l20); // at least 2 entries // separate (by fSep) all points between iL_in and iR_in in pTmpVert[] - while(iL < iR) + while (iL < iR) { tbool bReadyLeftSwap = TFALSE, bReadyRightSwap = TFALSE; - while((!bReadyLeftSwap) && iL=iL_in && iL<=iR_in); bReadyLeftSwap = !(pTmpVert[iL].vert[channel]=iL_in && iR<=iR_in); bReadyRightSwap = pTmpVert[iR].vert[channel]m_pInterface->m_getNumFaces(pContext); f++) + for (f=0; fm_pInterface->m_getNumFaces(pContext); f++) { const int verts = pContext->m_pInterface->m_getNumVerticesOfFace(pContext, f); - if(verts!=3 && verts!=4) continue; + if (verts!=3 && verts!=4) continue; pTriInfos[iDstTriIndex].iOrgFaceNumber = f; pTriInfos[iDstTriIndex].iTSpacesOffs = iTSpacesOffs; - if(verts==3) + if (verts==3) { unsigned char * pVerts = pTriInfos[iDstTriIndex].vert_num; pVerts[0]=0; pVerts[1]=1; pVerts[2]=2; @@ -810,7 +810,7 @@ static int GenerateInitialVerticesIndexList(STriInfo pTriInfos[], int piTriList_ const float distSQ_02 = LengthSquared(vsub(T2,T0)); const float distSQ_13 = LengthSquared(vsub(T3,T1)); tbool bQuadDiagIs_02; - if(distSQ_020 ? ORIENT_PRESERVING : 0); - if( NotZero(fSignedAreaSTx2) ) + if ( NotZero(fSignedAreaSTx2) ) { const float fAbsArea = fabsf(fSignedAreaSTx2); const float fLenOs = Length(vOs); const float fLenOt = Length(vOt); const float fS = (pTriInfos[f].iFlag&ORIENT_PRESERVING)==0 ? (-1.0f) : 1.0f; - if( NotZero(fLenOs) ) pTriInfos[f].vOs = vscale(fS/fLenOs, vOs); - if( NotZero(fLenOt) ) pTriInfos[f].vOt = vscale(fS/fLenOt, vOt); + if ( NotZero(fLenOs) ) pTriInfos[f].vOs = vscale(fS/fLenOs, vOs); + if ( NotZero(fLenOt) ) pTriInfos[f].vOt = vscale(fS/fLenOt, vOt); // evaluate magnitudes prior to normalization of vOs and vOt pTriInfos[f].fMagS = fLenOs / fAbsArea; pTriInfos[f].fMagT = fLenOt / fAbsArea; // if this is a good triangle - if( NotZero(pTriInfos[f].fMagS) && NotZero(pTriInfos[f].fMagT)) + if ( NotZero(pTriInfos[f].fMagS) && NotZero(pTriInfos[f].fMagT)) pTriInfos[f].iFlag &= (~GROUP_WITH_ANY); } } // force otherwise healthy quads to a fixed orientation - while(t<(iNrTrianglesIn-1)) + while (t<(iNrTrianglesIn-1)) { const int iFO_a = pTriInfos[t].iOrgFaceNumber; const int iFO_b = pTriInfos[t+1].iOrgFaceNumber; - if(iFO_a==iFO_b) // this is a quad + if (iFO_a==iFO_b) // this is a quad { const tbool bIsDeg_a = (pTriInfos[t].iFlag&MARK_DEGENERATE)!=0 ? TTRUE : TFALSE; const tbool bIsDeg_b = (pTriInfos[t+1].iFlag&MARK_DEGENERATE)!=0 ? TTRUE : TFALSE; // bad triangles should already have been removed by // DegenPrologue(), but just in case check bIsDeg_a and bIsDeg_a are false - if((bIsDeg_a||bIsDeg_b)==TFALSE) + if ((bIsDeg_a||bIsDeg_b)==TFALSE) { const tbool bOrientA = (pTriInfos[t].iFlag&ORIENT_PRESERVING)!=0 ? TTRUE : TFALSE; const tbool bOrientB = (pTriInfos[t+1].iFlag&ORIENT_PRESERVING)!=0 ? TTRUE : TFALSE; // if this happens the quad has extremely bad mapping!! - if(bOrientA!=bOrientB) + if (bOrientA!=bOrientB) { //printf("found quad with bad mapping\n"); tbool bChooseOrientFirstTri = TFALSE; - if((pTriInfos[t+1].iFlag&GROUP_WITH_ANY)!=0) bChooseOrientFirstTri = TTRUE; + if ((pTriInfos[t+1].iFlag&GROUP_WITH_ANY)!=0) bChooseOrientFirstTri = TTRUE; else if( CalcTexArea(pContext, &piTriListIn[t*3+0]) >= CalcTexArea(pContext, &piTriListIn[(t+1)*3+0]) ) bChooseOrientFirstTri = TTRUE; @@ -1048,7 +1048,7 @@ static void InitTriInfo(STriInfo pTriInfos[], const int piTriListIn[], const SMi // match up edge pairs { SEdge * pEdges = (SEdge *) malloc(sizeof(SEdge)*iNrTrianglesIn*3); - if(pEdges==NULL) + if (pEdges==NULL) BuildNeighborsSlow(pTriInfos, piTriListIn, iNrTrianglesIn); else { @@ -1070,12 +1070,12 @@ static int Build4RuleGroups(STriInfo pTriInfos[], SGroup pGroups[], int piGroupT const int iNrMaxGroups = iNrTrianglesIn*3; int iNrActiveGroups = 0; int iOffset = 0, f=0, i=0; - for(f=0; f0?(i-1):2]; - if(neigh_indexL>=0) // neighbor + if (neigh_indexL>=0) // neighbor { const tbool bAnswer = AssignRecur(piTriListIn, pTriInfos, neigh_indexL, @@ -1102,7 +1102,7 @@ static int Build4RuleGroups(STriInfo pTriInfos[], SGroup pGroups[], int piGroupT const tbool bDiff = bOrPre!=bOrPre2 ? TTRUE : TFALSE; assert(bAnswer || bDiff); } - if(neigh_indexR>=0) // neighbor + if (neigh_indexR>=0) // neighbor { const tbool bAnswer = AssignRecur(piTriListIn, pTriInfos, neigh_indexR, @@ -1141,20 +1141,20 @@ static tbool AssignRecur(const int piTriListIn[], STriInfo psTriInfos[], const int iVertRep = pGroup->iVertexRepresentitive; const int * pVerts = &piTriListIn[3*iMyTriIndex+0]; int i=-1; - if(pVerts[0]==iVertRep) i=0; + if (pVerts[0]==iVertRep) i=0; else if(pVerts[1]==iVertRep) i=1; else if(pVerts[2]==iVertRep) i=2; assert(i>=0 && i<3); // early out - if(pMyTriInfo->AssignedGroup[i] == pGroup) return TTRUE; + if (pMyTriInfo->AssignedGroup[i] == pGroup) return TTRUE; else if(pMyTriInfo->AssignedGroup[i]!=NULL) return TFALSE; - if((pMyTriInfo->iFlag&GROUP_WITH_ANY)!=0) + if ((pMyTriInfo->iFlag&GROUP_WITH_ANY)!=0) { // first to group with a group-with-anything triangle // determines it's orientation. // This is the only existing order dependency in the code!! - if( pMyTriInfo->AssignedGroup[0] == NULL && + if ( pMyTriInfo->AssignedGroup[0] == NULL && pMyTriInfo->AssignedGroup[1] == NULL && pMyTriInfo->AssignedGroup[2] == NULL ) { @@ -1164,7 +1164,7 @@ static tbool AssignRecur(const int piTriListIn[], STriInfo psTriInfos[], } { const tbool bOrient = (pMyTriInfo->iFlag&ORIENT_PRESERVING)!=0 ? TTRUE : TFALSE; - if(bOrient != pGroup->bOrientPreservering) return TFALSE; + if (bOrient != pGroup->bOrientPreservering) return TFALSE; } AddTriToGroup(pGroup, iMyTriIndex); @@ -1173,9 +1173,9 @@ static tbool AssignRecur(const int piTriListIn[], STriInfo psTriInfos[], { const int neigh_indexL = pMyTriInfo->FaceNeighbors[i]; const int neigh_indexR = pMyTriInfo->FaceNeighbors[i>0?(i-1):2]; - if(neigh_indexL>=0) + if (neigh_indexL>=0) AssignRecur(piTriListIn, psTriInfos, neigh_indexL, pGroup); - if(neigh_indexR>=0) + if (neigh_indexR>=0) AssignRecur(piTriListIn, psTriInfos, neigh_indexR, pGroup); } @@ -1199,39 +1199,39 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con SSubGroup * pUniSubGroups = NULL; int * pTmpMembers = NULL; int iMaxNrFaces=0, iUniqueTspaces=0, g=0, i=0; - for(g=0; giNrFaces; i++) // triangles + for (i=0; iiNrFaces; i++) // triangles { const int f = pGroup->pFaceIndices[i]; // triangle number int index=-1, iVertIndex=-1, iOF_1=-1, iMembers=0, j=0, l=0; SSubGroup tmp_group; tbool bFound; SVec3 n, vOs, vOt; - if(pTriInfos[f].AssignedGroup[0]==pGroup) index=0; + if (pTriInfos[f].AssignedGroup[0]==pGroup) index=0; else if(pTriInfos[f].AssignedGroup[1]==pGroup) index=1; else if(pTriInfos[f].AssignedGroup[2]==pGroup) index=2; assert(index>=0 && index<3); @@ -1245,14 +1245,14 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con // project vOs = vsub(pTriInfos[f].vOs, vscale(vdot(n,pTriInfos[f].vOs), n)); vOt = vsub(pTriInfos[f].vOt, vscale(vdot(n,pTriInfos[f].vOt), n)); - if( VNotZero(vOs) ) vOs = Normalize(vOs); - if( VNotZero(vOt) ) vOt = Normalize(vOt); + if ( VNotZero(vOs) ) vOs = Normalize(vOs); + if ( VNotZero(vOt) ) vOt = Normalize(vOt); // original face number iOF_1 = pTriInfos[f].iOrgFaceNumber; iMembers = 0; - for(j=0; jiNrFaces; j++) + for (j=0; jiNrFaces; j++) { const int t = pGroup->pFaceIndices[j]; // triangle number const int iOF_2 = pTriInfos[t].iOrgFaceNumber; @@ -1260,8 +1260,8 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con // project SVec3 vOs2 = vsub(pTriInfos[t].vOs, vscale(vdot(n,pTriInfos[t].vOs), n)); SVec3 vOt2 = vsub(pTriInfos[t].vOt, vscale(vdot(n,pTriInfos[t].vOt), n)); - if( VNotZero(vOs2) ) vOs2 = Normalize(vOs2); - if( VNotZero(vOt2) ) vOt2 = Normalize(vOt2); + if ( VNotZero(vOs2) ) vOs2 = Normalize(vOs2); + if ( VNotZero(vOt2) ) vOt2 = Normalize(vOt2); { const tbool bAny = ( (pTriInfos[f].iFlag | pTriInfos[t].iFlag) & GROUP_WITH_ANY )!=0 ? TTRUE : TFALSE; @@ -1272,7 +1272,7 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con const float fCosT = vdot(vOt,vOt2); assert(f!=t || bSameOrgFace); // sanity check - if(bAny || bSameOrgFace || (fCosS>fThresCos && fCosT>fThresCos)) + if (bAny || bSameOrgFace || (fCosS>fThresCos && fCosT>fThresCos)) pTmpMembers[iMembers++] = t; } } @@ -1280,7 +1280,7 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con // sort pTmpMembers tmp_group.iNrFaces = iMembers; tmp_group.pTriMembers = pTmpMembers; - if(iMembers>1) + if (iMembers>1) { unsigned int uSeed = INTERNAL_RND_SORT_SEED; // could replace with a random seed? QuickSort(pTmpMembers, 0, iMembers-1, uSeed); @@ -1289,10 +1289,10 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con // look for an existing match bFound = TFALSE; l=0; - while(liCounter<2); assert(((pTriInfos[f].iFlag&ORIENT_PRESERVING)!=0) == pGroup->bOrientPreservering); - if(pTS_out->iCounter==1) + if (pTS_out->iCounter==1) { *pTS_out = AvgTSpace(pTS_out, &pSubGroupTspace[l]); pTS_out->iCounter = 2; // update counter @@ -1347,7 +1347,7 @@ static tbool GenerateTSpaces(STSpace psTspace[], const STriInfo pTriInfos[], con } // clean up and offset iUniqueTspaces - for(s=0; s=0 && i<3); @@ -1390,8 +1390,8 @@ static STSpace EvalTspace(int face_indices[], const int iFaces, const int piTriL n = GetNormal(pContext, index); vOs = vsub(pTriInfos[f].vOs, vscale(vdot(n,pTriInfos[f].vOs), n)); vOt = vsub(pTriInfos[f].vOt, vscale(vdot(n,pTriInfos[f].vOt), n)); - if( VNotZero(vOs) ) vOs = Normalize(vOs); - if( VNotZero(vOt) ) vOt = Normalize(vOt); + if ( VNotZero(vOs) ) vOs = Normalize(vOs); + if ( VNotZero(vOt) ) vOt = Normalize(vOt); i2 = piTriListIn[3*f + (i<2?(i+1):0)]; i1 = piTriListIn[3*f + i]; @@ -1423,9 +1423,9 @@ static STSpace EvalTspace(int face_indices[], const int iFaces, const int piTriL } // normalize - if( VNotZero(res.vOs) ) res.vOs = Normalize(res.vOs); - if( VNotZero(res.vOt) ) res.vOt = Normalize(res.vOt); - if(fAngleSum>0) + if ( VNotZero(res.vOs) ) res.vOs = Normalize(res.vOs); + if ( VNotZero(res.vOt) ) res.vOt = Normalize(res.vOt); + if (fAngleSum>0) { res.fMagS /= fAngleSum; res.fMagT /= fAngleSum; @@ -1438,11 +1438,11 @@ static tbool CompareSubGroups(const SSubGroup * pg1, const SSubGroup * pg2) { tbool bStillSame=TTRUE; int i=0; - if(pg1->iNrFaces!=pg2->iNrFaces) return TFALSE; - while(iiNrFaces && bStillSame) + if (pg1->iNrFaces!=pg2->iNrFaces) return TFALSE; + while (iiNrFaces && bStillSame) { bStillSame = pg1->pTriMembers[i]==pg2->pTriMembers[i] ? TTRUE : TFALSE; - if(bStillSame) ++i; + if (bStillSame) ++i; } return bStillSame; } @@ -1467,12 +1467,12 @@ static void QuickSort(int* pSortBuffer, int iLeft, int iRight, unsigned int uSee do { - while(pSortBuffer[iL] < iMid) + while (pSortBuffer[iL] < iMid) ++iL; - while(pSortBuffer[iR] > iMid) + while (pSortBuffer[iR] > iMid) --iR; - if(iL <= iR) + if (iL <= iR) { iTmp = pSortBuffer[iL]; pSortBuffer[iL] = pSortBuffer[iR]; @@ -1480,11 +1480,11 @@ static void QuickSort(int* pSortBuffer, int iLeft, int iRight, unsigned int uSee ++iL; --iR; } } - while(iL <= iR); + while (iL <= iR); - if(iLeft < iR) + if (iLeft < iR) QuickSort(pSortBuffer, iLeft, iR, uSeed); - if(iL < iRight) + if (iL < iRight) QuickSort(pSortBuffer, iL, iRight, uSeed); } @@ -1499,8 +1499,8 @@ static void BuildNeighborsFast(STriInfo pTriInfos[], SEdge * pEdges, const int p // build array of edges unsigned int uSeed = INTERNAL_RND_SORT_SEED; // could replace with a random seed? int iEntries=0, iCurStartIndex=-1, f=0, i=0; - for(f=0; f pSortBuffer[iRight].array[channel]) + if (pSortBuffer[iLeft].array[channel] > pSortBuffer[iRight].array[channel]) { sTmp = pSortBuffer[iLeft]; pSortBuffer[iLeft] = pSortBuffer[iRight]; @@ -1673,12 +1673,12 @@ static void QuickSortEdges(SEdge * pSortBuffer, int iLeft, int iRight, const int do { - while(pSortBuffer[iL].array[channel] < iMid) + while (pSortBuffer[iL].array[channel] < iMid) ++iL; - while(pSortBuffer[iR].array[channel] > iMid) + while (pSortBuffer[iR].array[channel] > iMid) --iR; - if(iL <= iR) + if (iL <= iR) { sTmp = pSortBuffer[iL]; pSortBuffer[iL] = pSortBuffer[iR]; @@ -1686,11 +1686,11 @@ static void QuickSortEdges(SEdge * pSortBuffer, int iLeft, int iRight, const int ++iL; --iR; } } - while(iL <= iR); + while (iL <= iR); - if(iLeft < iR) + if (iLeft < iR) QuickSortEdges(pSortBuffer, iLeft, iR, channel, uSeed); - if(iL < iRight) + if (iL < iRight) QuickSortEdges(pSortBuffer, iL, iRight, channel, uSeed); } @@ -1700,10 +1700,10 @@ static void GetEdge(int * i0_out, int * i1_out, int * edgenum_out, const int ind *edgenum_out = -1; // test if first index is on the edge - if(indices[0]==i0_in || indices[0]==i1_in) + if (indices[0]==i0_in || indices[0]==i1_in) { // test if second index is on the edge - if(indices[1]==i0_in || indices[1]==i1_in) + if (indices[1]==i0_in || indices[1]==i1_in) { edgenum_out[0]=0; // first edge i0_out[0]=indices[0]; @@ -1736,15 +1736,15 @@ static void DegenPrologue(STriInfo pTriInfos[], int piTriList_out[], const int i // locate quads with only one good triangle int t=0; - while(t<(iTotTris-1)) + while (t<(iTotTris-1)) { const int iFO_a = pTriInfos[t].iOrgFaceNumber; const int iFO_b = pTriInfos[t+1].iOrgFaceNumber; - if(iFO_a==iFO_b) // this is a quad + if (iFO_a==iFO_b) // this is a quad { const tbool bIsDeg_a = (pTriInfos[t].iFlag&MARK_DEGENERATE)!=0 ? TTRUE : TFALSE; const tbool bIsDeg_b = (pTriInfos[t+1].iFlag&MARK_DEGENERATE)!=0 ? TTRUE : TFALSE; - if((bIsDeg_a^bIsDeg_b)!=0) + if ((bIsDeg_a^bIsDeg_b)!=0) { pTriInfos[t].iFlag |= QUAD_ONE_DEGEN_TRI; pTriInfos[t+1].iFlag |= QUAD_ONE_DEGEN_TRI; @@ -1760,12 +1760,12 @@ static void DegenPrologue(STriInfo pTriInfos[], int piTriList_out[], const int i iNextGoodTriangleSearchIndex = 1; t=0; bStillFindingGoodOnes = TTRUE; - while(t (t+1)); // swap triangle t0 and t1 - if(!bJustADegenerate) + if (!bJustADegenerate) { int i=0; - for(i=0; i<3; i++) + for (i=0; i<3; i++) { const int index = piTriList_out[t0*3+i]; piTriList_out[t0*3+i] = piTriList_out[t1*3+i]; @@ -1805,7 +1805,7 @@ static void DegenPrologue(STriInfo pTriInfos[], int piTriList_out[], const int i bStillFindingGoodOnes = TFALSE; // this is not supposed to happen } - if(bStillFindingGoodOnes) ++t; + if (bStillFindingGoodOnes) ++t; } assert(bStillFindingGoodOnes); // code will still work. @@ -1817,28 +1817,28 @@ static void DegenEpilogue(STSpace psTspace[], STriInfo pTriInfos[], int piTriLis int t=0, i=0; // deal with degenerate triangles // punishment for degenerate triangles is O(N^2) - for(t=iNrTrianglesIn; t