Fix GCC warnings with -Wconversion and bitfields:

- apply bitmask in member initialization to suppress warning
    - add public Set...() with bitmask for assignment by users
    - replace any assignments with new public Set...() methods
This commit is contained in:
Barry Fowler 2022-08-30 14:34:17 -07:00
parent 04c60c992d
commit 8b863a0009
4 changed files with 21 additions and 8 deletions

View File

@ -86,7 +86,8 @@ PatchTreeBuilder::PatchTreeBuilder(TopologyRefiner & faceRefiner,
//
TopologyRefiner::AdaptiveOptions adaptiveOptions(adaptiveLevelPrimary);
adaptiveOptions.secondaryLevel = adaptiveLevelSecondary;
adaptiveOptions.SetSecondaryLevel(adaptiveLevelSecondary);
adaptiveOptions.useInfSharpPatch = true;
adaptiveOptions.useSingleCreasePatch = false;
adaptiveOptions.considerFVarChannels = false;

View File

@ -67,7 +67,7 @@ public:
triangulateQuads(false),
useSingleCreasePatch(false),
useInfSharpPatch(false),
maxIsolationLevel(maxIsolation),
maxIsolationLevel(maxIsolation & 0xf),
endCapType(ENDCAP_GREGORY_BASIS),
shareEndCapPatchPoints(true),
generateVaryingTables(true),
@ -85,7 +85,10 @@ public:
EndCapType GetEndCapType() const { return (EndCapType)endCapType; }
/// \brief Set endcap basis type
void SetEndCapType(EndCapType e) { endCapType = e; }
void SetEndCapType(EndCapType e) { endCapType = e & 0x7; }
/// \brief Set maximum isolation level
void SetMaxIsolationLevel(unsigned int level) { maxIsolationLevel = level & 0xf; }
/// \brief Set precision of vertex patches
template <typename REAL> void SetPatchPrecision();

View File

@ -118,10 +118,13 @@ public:
struct UniformOptions {
UniformOptions(int level) :
refinementLevel(level),
refinementLevel(level & 0xf),
orderVerticesFromFacesFirst(false),
fullTopologyInLastLevel(false) { }
/// \brief Set uniform refinement level
void SetRefinementLevel(int level) { refinementLevel = level & 0xf; }
unsigned int refinementLevel:4, ///< Number of refinement iterations
orderVerticesFromFacesFirst:1, ///< Order child vertices from faces first
///< instead of child vertices of vertices
@ -153,13 +156,19 @@ public:
struct AdaptiveOptions {
AdaptiveOptions(int level) :
isolationLevel(level),
secondaryLevel(15),
isolationLevel(level & 0xf),
secondaryLevel(0xf),
useSingleCreasePatch(false),
useInfSharpPatch(false),
considerFVarChannels(false),
orderVerticesFromFacesFirst(false) { }
/// \brief Set isolation level
void SetIsolationLevel(int level) { isolationLevel = level & 0xf; }
/// \brief Set secondary isolation level
void SetSecondaryLevel(int level) { secondaryLevel = level & 0xf; }
unsigned int isolationLevel:4; ///< Number of iterations applied to isolate
///< extraordinary vertices and creases
unsigned int secondaryLevel:4; ///< Shallower level to stop isolation of

View File

@ -73,8 +73,8 @@ FarPatchEvaluator<REAL>::FarPatchEvaluator(
Far::TopologyRefiner::AdaptiveOptions refineOptions =
patchOptions.GetRefineAdaptiveOptions();
refineOptions.isolationLevel = primaryLevel;
refineOptions.secondaryLevel = secondaryLevel;
refineOptions.SetIsolationLevel(primaryLevel);
refineOptions.SetSecondaryLevel(secondaryLevel);
//
// Create a TopologyRefiner (sharing the base) to adaptively refine