From 7763ffcb3dda93bd2541ca0709d38eee7b22d6bc Mon Sep 17 00:00:00 2001 From: Nathan Litke Date: Wed, 25 Jun 2014 11:11:06 -0700 Subject: [PATCH] Style fixes for changes from v2_5_0..ad84f06. --- .../far/catmarkSubdivisionTablesFactory.h | 50 +++++++++---------- opensubdiv/far/kernelBatchFactory.h | 6 +-- opensubdiv/far/meshFactory.h | 4 +- opensubdiv/far/subdivisionTables.h | 6 +-- opensubdiv/far/subdivisionTablesFactory.h | 6 +-- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/opensubdiv/far/catmarkSubdivisionTablesFactory.h b/opensubdiv/far/catmarkSubdivisionTablesFactory.h index 73ccb430..0def165e 100644 --- a/opensubdiv/far/catmarkSubdivisionTablesFactory.h +++ b/opensubdiv/far/catmarkSubdivisionTablesFactory.h @@ -81,19 +81,19 @@ FarCatmarkSubdivisionTablesFactory::Create( FarMeshFactory * meshFacto // Calculate the size of the face-vertex indexing tables int minCoarseFaceValence = tablesFactory.GetMinCoarseFaceValence(); int maxCoarseFaceValence = tablesFactory.GetMaxCoarseFaceValence(); - bool coarseMeshAllQuadFaces = minCoarseFaceValence == 4 && maxCoarseFaceValence == 4; - bool coarseMeshAllTriQuadFaces = minCoarseFaceValence >= 3 && maxCoarseFaceValence <= 4; + bool coarseMeshAllQuadFaces = minCoarseFaceValence == 4 and maxCoarseFaceValence == 4; + bool coarseMeshAllTriQuadFaces = minCoarseFaceValence >= 3 and maxCoarseFaceValence <= 4; bool hasQuadFaceVertexKernel = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_QUAD_FACE_VERTEX); bool hasTriQuadFaceVertexKernel = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_TRI_QUAD_FACE_VERTEX); int F_ITa_size = 0; - if (!hasQuadFaceVertexKernel && !hasTriQuadFaceVertexKernel) + if (not hasQuadFaceVertexKernel and not hasTriQuadFaceVertexKernel) F_ITa_size = tablesFactory.GetNumFaceVerticesTotal(maxlevel) * 2; - else if (!coarseMeshAllTriQuadFaces || !hasTriQuadFaceVertexKernel) + else if (not coarseMeshAllTriQuadFaces or not hasTriQuadFaceVertexKernel) F_ITa_size = tablesFactory.GetNumFaceVerticesTotal(1) * 2; int F_IT_size = tablesFactory.GetFaceVertsValenceSum(); - if (coarseMeshAllTriQuadFaces && hasTriQuadFaceVertexKernel) + if (coarseMeshAllTriQuadFaces and hasTriQuadFaceVertexKernel) F_IT_size += tablesFactory.GetNumCoarseTriangleFaces(); // add padding for tri faces // Triangular interpolation mode : @@ -102,29 +102,29 @@ FarCatmarkSubdivisionTablesFactory::Create( FarMeshFactory * meshFacto dynamic_cast *>(meshFactory->GetHbrMesh()->GetSubdivision())->GetTriangleSubdivisionMethod(); bool hasFractionalEdgeSharpness = tablesFactory.HasFractionalEdgeSharpness(); bool useRestrictedEdgeVertexKernel = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_RESTRICTED_EDGE_VERTEX); - useRestrictedEdgeVertexKernel &= !hasFractionalEdgeSharpness && triangleMethod != HbrCatmarkSubdivision::k_New; + useRestrictedEdgeVertexKernel &= not hasFractionalEdgeSharpness and triangleMethod != HbrCatmarkSubdivision::k_New; bool hasFractionalVertexSharpness = tablesFactory.HasFractionalVertexSharpness(); - bool hasStandardVertexVertexKernels = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_VERT_VERTEX_A1) && - meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_VERT_VERTEX_A2) && + bool hasStandardVertexVertexKernels = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_VERT_VERTEX_A1) and + meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_VERT_VERTEX_A2) and meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_VERT_VERTEX_B); - bool useRestrictedVertexVertexKernels = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_RESTRICTED_VERT_VERTEX_A) && - meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_RESTRICTED_VERT_VERTEX_B1) && + bool useRestrictedVertexVertexKernels = meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_RESTRICTED_VERT_VERTEX_A) and + meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_RESTRICTED_VERT_VERTEX_B1) and meshFactory->IsKernelTypeSupported(FarKernelBatch::CATMARK_RESTRICTED_VERT_VERTEX_B2); - useRestrictedVertexVertexKernels &= !hasFractionalVertexSharpness && !hasFractionalEdgeSharpness; + useRestrictedVertexVertexKernels &= not hasFractionalVertexSharpness and not hasFractionalEdgeSharpness; // Allocate memory for the indexing tables result->_F_ITa.resize(F_ITa_size); result->_F_IT.resize(F_IT_size); result->_E_IT.resize(tablesFactory.GetNumEdgeVerticesTotal(maxlevel)*4); - if (!useRestrictedEdgeVertexKernel) + if (not useRestrictedEdgeVertexKernel) result->_E_W.resize(tablesFactory.GetNumEdgeVerticesTotal(maxlevel)*2); result->_V_ITa.resize((tablesFactory.GetNumVertexVerticesTotal(maxlevel) - tablesFactory.GetNumVertexVerticesTotal(0))*5); // subtract coarse cage vertices result->_V_IT.resize(tablesFactory.GetVertVertsValenceSum()*2); - if (!useRestrictedVertexVertexKernels) + if (not useRestrictedVertexVertexKernels) result->_V_W.resize(tablesFactory.GetNumVertexVerticesTotal(maxlevel) - tablesFactory.GetNumVertexVerticesTotal(0)); @@ -159,9 +159,9 @@ FarCatmarkSubdivisionTablesFactory::Create( FarMeshFactory * meshFacto // choose the kernel type that best fits the face topology int kernelType = FarKernelBatch::CATMARK_FACE_VERTEX; if (level == 1) { - if (coarseMeshAllQuadFaces && hasQuadFaceVertexKernel) + if (coarseMeshAllQuadFaces and hasQuadFaceVertexKernel) kernelType = FarKernelBatch::CATMARK_QUAD_FACE_VERTEX; - else if (coarseMeshAllTriQuadFaces && hasTriQuadFaceVertexKernel) + else if (coarseMeshAllTriQuadFaces and hasTriQuadFaceVertexKernel) kernelType = FarKernelBatch::CATMARK_TRI_QUAD_FACE_VERTEX; } else { if (hasQuadFaceVertexKernel) @@ -215,7 +215,7 @@ FarCatmarkSubdivisionTablesFactory::Create( FarMeshFactory * meshFacto for (int j=0; jGetVertex(j)->GetID()]; - if (kernelType == FarKernelBatch::CATMARK_TRI_QUAD_FACE_VERTEX && valence == 3) + if (kernelType == FarKernelBatch::CATMARK_TRI_QUAD_FACE_VERTEX and valence == 3) F_IT[F_IT_offset++] = remap[f->GetVertex(2)->GetID()]; // repeat last index } @@ -262,7 +262,7 @@ FarCatmarkSubdivisionTablesFactory::Create( FarMeshFactory * meshFacto if (kernelType == FarKernelBatch::CATMARK_RESTRICTED_EDGE_VERTEX) { // in the case of a sharp edge, repeat the endpoint vertices - if (!e->IsBoundary() && esharp == HbrHalfedge::k_Smooth) { + if (not e->IsBoundary() and esharp == HbrHalfedge::k_Smooth) { HbrFace* rf = e->GetRightFace(); HbrFace* lf = e->GetLeftFace(); @@ -272,7 +272,7 @@ FarCatmarkSubdivisionTablesFactory::Create( FarMeshFactory * meshFacto E_IT[4*i+2] = E_IT[4*i+0]; E_IT[4*i+3] = E_IT[4*i+1]; } - } else if (!e->IsBoundary() && esharp <= HbrHalfedge::k_Sharp) { + } else if (not e->IsBoundary() and esharp <= HbrHalfedge::k_Sharp) { // in the case of a fractional sharpness, set the adjacent faces vertices float leftWeight, rightWeight; @@ -397,7 +397,7 @@ FarCatmarkSubdivisionTablesFactory::Create( FarMeshFactory * meshFacto break; } case HbrVertex::k_Corner : - if (!useRestrictedVertexVertexKernels) { + if (not useRestrictedVertexVertexKernels) { // in the case of a k_Crease / k_Corner pass combination, we // need to set the valence to -1 to tell the "B" Kernel to // switch to k_Corner rule (as edge indices won't be -1) @@ -412,7 +412,7 @@ FarCatmarkSubdivisionTablesFactory::Create( FarMeshFactory * meshFacto default : break; } - if (!useRestrictedVertexVertexKernels) { + if (not useRestrictedVertexVertexKernels) { if (rank>7) // the k_Corner and k_Crease single-pass cases apply a weight of 1.0 // but this value is inverted in the kernel @@ -421,18 +421,18 @@ FarCatmarkSubdivisionTablesFactory::Create( FarMeshFactory * meshFacto V_W[i] = weights[0]; } - if (!useRestrictedVertexVertexKernels) + if (not useRestrictedVertexVertexKernels) batchFactory.AddVertex( i, rank ); else batchFactory.AddCatmarkRestrictedVertex( i, rank, V_ITa[5*i+1] ); } V_ITa += nVertVertices*5; - if (!useRestrictedVertexVertexKernels) + if (not useRestrictedVertexVertexKernels) V_W += nVertVertices; // add batches for vert vertices if (nVertVertices > 0) { - if (!useRestrictedVertexVertexKernels) { + if (not useRestrictedVertexVertexKernels) { assert(hasStandardVertexVertexKernels); batchFactory.AppendCatmarkBatches(level, vertTableOffset, vertexOffset, batches); } else { @@ -460,8 +460,8 @@ FarCatmarkSubdivisionTablesFactory::CompareVertices( HbrVertex const * x assert( rankx!=0xFF and ranky!=0xFF ); // Arrange regular vertices before irregular vertices within the same kernel - if ((rankx <= 2 && ranky <= 2) || (rankx >= 3 && rankx <= 7 && ranky >= 3 && ranky <= 7) || (rankx >= 8 && ranky >= 8)) - return px->GetValence() == 4 && py->GetValence() != 4; + if ((rankx <= 2 and ranky <= 2) or (rankx >= 3 and rankx <= 7 and ranky >= 3 and ranky <= 7) or (rankx >= 8 and ranky >= 8)) + return px->GetValence() == 4 and py->GetValence() != 4; else return rankx < ranky; } diff --git a/opensubdiv/far/kernelBatchFactory.h b/opensubdiv/far/kernelBatchFactory.h index c987d7d7..44581ba6 100644 --- a/opensubdiv/far/kernelBatchFactory.h +++ b/opensubdiv/far/kernelBatchFactory.h @@ -191,14 +191,14 @@ FarVertexKernelBatchFactory::AddVertex( int index, int rank ) { inline void FarVertexKernelBatchFactory::AddCatmarkRestrictedVertex( int index, int rank, int valence ) { - assert(rank <= 2 || rank >= 8); + assert(rank <= 2 or rank >= 8); - if (rank <= 2 && valence == 4) { + if (rank <= 2 and valence == 4) { if (index < restrictedKernelB1.start) restrictedKernelB1.start=index; if (index > restrictedKernelB1.end) restrictedKernelB1.end=index; - } else if (rank <= 2 && valence != 4) { + } else if (rank <= 2 and valence != 4) { if (index < restrictedKernelB2.start) restrictedKernelB2.start=index; if (index > restrictedKernelB2.end) diff --git a/opensubdiv/far/meshFactory.h b/opensubdiv/far/meshFactory.h index 1f85f4bd..56cd5cd8 100644 --- a/opensubdiv/far/meshFactory.h +++ b/opensubdiv/far/meshFactory.h @@ -168,7 +168,7 @@ public: /// @return true if the kernel type is supported /// bool IsKernelTypeSupported(int kernelType) const { - assert(kernelType >= FarKernelBatch::FIRST_KERNEL_TYPE && + assert(kernelType >= FarKernelBatch::FIRST_KERNEL_TYPE and kernelType < FarKernelBatch::NUM_KERNEL_TYPES); return _supportedKernelTypes[kernelType]; } @@ -655,7 +655,7 @@ FarMeshFactory::FarMeshFactory( HbrMesh * mesh, int maxlevel, bool adapt } for (int i = kernelTypes ? *kernelTypes++ : 0; i; i = *kernelTypes++) { - assert(i >= FarKernelBatch::FIRST_KERNEL_TYPE && + assert(i >= FarKernelBatch::FIRST_KERNEL_TYPE and i < FarKernelBatch::NUM_KERNEL_TYPES); _supportedKernelTypes[i] = true; } diff --git a/opensubdiv/far/subdivisionTables.h b/opensubdiv/far/subdivisionTables.h index bd0d5fee..e1fa9ca2 100644 --- a/opensubdiv/far/subdivisionTables.h +++ b/opensubdiv/far/subdivisionTables.h @@ -437,8 +437,8 @@ FarSubdivisionTables::computeCatmarkTriQuadFacePoints( int vertexOffset, int tab int fidx2 = _F_IT[tableOffset + 4 * i + 2]; int fidx3 = _F_IT[tableOffset + 4 * i + 3]; - bool triangle = (fidx3 == fidx2); - float weight = triangle ? 1.0f / 3.0f : 1.0f / 4.0f; + bool isTriangle = (fidx3 == fidx2); + float weight = isTriangle ? 1.0f / 3.0f : 1.0f / 4.0f; vdst->Clear(); vdst->AddWithWeight(vsrc[fidx0], weight); @@ -447,7 +447,7 @@ FarSubdivisionTables::computeCatmarkTriQuadFacePoints( int vertexOffset, int tab vdst->AddVaryingWithWeight(vsrc[fidx1], weight); vdst->AddWithWeight(vsrc[fidx2], weight); vdst->AddVaryingWithWeight(vsrc[fidx2], weight); - if (!triangle) { + if (not isTriangle) { vdst->AddWithWeight(vsrc[fidx3], weight); vdst->AddVaryingWithWeight(vsrc[fidx3], weight); } diff --git a/opensubdiv/far/subdivisionTablesFactory.h b/opensubdiv/far/subdivisionTablesFactory.h index 7f9b2691..c66b5fd1 100644 --- a/opensubdiv/far/subdivisionTablesFactory.h +++ b/opensubdiv/far/subdivisionTablesFactory.h @@ -220,13 +220,13 @@ FarSubdivisionTablesFactory::FarSubdivisionTablesFactory( HbrMesh const // Determine if any edges have fractional sharpness. float sharpness = v->GetParentEdge()->GetSharpness(); - if (sharpness > HbrHalfedge::k_Smooth && sharpness < HbrHalfedge::k_Sharp) + if (sharpness > HbrHalfedge::k_Smooth and sharpness < HbrHalfedge::k_Sharp) _hasFractionalEdgeSharpness = true; } else if (v->GetParentVertex()) { vertCounts[depth]++; _vertVertsValenceSum+=sumVertVertexValence(v); float sharpness = v->GetParentVertex()->GetSharpness(); - if (sharpness > 0.0f && sharpness < 1.0f) + if (sharpness > 0.0f and sharpness < 1.0f) _hasFractionalVertexSharpness = true; } } @@ -571,7 +571,7 @@ FarSubdivisionTablesFactory::Splice(FarMeshVector const &meshes, FarKernelB // copy edge tables E_IT = copyWithOffsetE_IT(E_IT, tables->Get_E_IT(), vertexOffsets[i]); - if (!tables->Get_E_W().empty()) + if (not tables->Get_E_W().empty()) E_W = copyWithOffset(E_W, tables->Get_E_W(), 0); else E_W += tables->Get_E_IT().size() / 2;