From 7cb2463dc74ddbf3c43ee1f662878689c5d8377d Mon Sep 17 00:00:00 2001 From: manuelk Date: Mon, 10 Jun 2013 14:36:25 -0700 Subject: [PATCH] fix FarPatchTables::IsFeatureAdaptive() : - trivial return if Gregory specific patch data is set - or iterate through the patch-arrays until an adaptive patch is found (REGULAR,...,GREGORY_BOUNDARY) fixes #173 --- opensubdiv/far/patchTables.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/opensubdiv/far/patchTables.h b/opensubdiv/far/patchTables.h index cc59467a..b3677fe8 100644 --- a/opensubdiv/far/patchTables.h +++ b/opensubdiv/far/patchTables.h @@ -531,7 +531,23 @@ FarPatchTables::FarPatchTables(PatchArrayVector const & patchArrays, inline bool FarPatchTables::IsFeatureAdaptive() const { - return ((not _vertexValenceTable.empty()) and (not _quadOffsetTable.empty())); + + // the vertex valence table is only used by Gregory patches, so the PatchTables + // contain feature adaptive patches if this is not empty. + if (not _vertexValenceTable.empty()) + return true; + + PatchArrayVector const & parrays = GetPatchArrayVector(); + + // otherwise, we have to check each patch array + for (int i=0; i<(int)parrays.size(); ++i) { + + if (parrays[i].GetDescriptor().GetType() >= REGULAR and + parrays[i].GetDescriptor().GetType() <= GREGORY_BOUNDARY) + return true; + + } + return false; } // Returns the number of control vertices expected for a patch of this type