Merge pull request #859 from davidgyu/patch_descriptor

Removed bitfield size from Far::PatchDescriptor
This commit is contained in:
barfowl 2016-09-29 10:52:59 -07:00 committed by GitHub
commit 49cfba45a3

View File

@ -47,12 +47,6 @@ namespace Far {
/// * Adaptively subdivided meshes contain bicubic patches of types REGULAR, /// * Adaptively subdivided meshes contain bicubic patches of types REGULAR,
/// GREGORY, GREGORY_BOUNDARY, GREGORY_BASIS. /// GREGORY, GREGORY_BOUNDARY, GREGORY_BASIS.
/// ///
/// Bitfield layout :
///
/// Field | Bits | Content
/// ------------|:----:|------------------------------------------------------
/// _type | 4 | patch type
///
class PatchDescriptor { class PatchDescriptor {
public: public:
@ -107,6 +101,7 @@ public:
/// type described /// type described
static inline short GetNumControlVertices( Type t ); static inline short GetNumControlVertices( Type t );
/// \brief Deprecated @see PatchDescriptor#GetNumControlVertices
static inline short GetNumFVarControlVertices( Type t ); static inline short GetNumFVarControlVertices( Type t );
/// \brief Returns the number of control vertices expected for a patch of the /// \brief Returns the number of control vertices expected for a patch of the
@ -115,8 +110,7 @@ public:
return GetNumControlVertices( this->GetType() ); return GetNumControlVertices( this->GetType() );
} }
/// \brief Returns the number of control vertices expected for a patch of the /// \brief Deprecated @see PatchDescriptor#GetNumControlVertices
/// type described
short GetNumFVarControlVertices() const { short GetNumFVarControlVertices() const {
return GetNumFVarControlVertices( this->GetType() ); return GetNumFVarControlVertices( this->GetType() );
} }
@ -145,7 +139,7 @@ public:
void print() const; void print() const;
private: private:
unsigned int _type:4; unsigned int _type;
}; };
typedef Vtr::ConstArray<PatchDescriptor> ConstPatchDescriptorArray; typedef Vtr::ConstArray<PatchDescriptor> ConstPatchDescriptorArray;
@ -169,17 +163,7 @@ PatchDescriptor::GetNumControlVertices( Type type ) {
// Returns the number of face-varying control vertices expected for a patch of this type // Returns the number of face-varying control vertices expected for a patch of this type
inline short inline short
PatchDescriptor::GetNumFVarControlVertices( Type type ) { PatchDescriptor::GetNumFVarControlVertices( Type type ) {
switch (type) { return PatchDescriptor::GetNumControlVertices(type);
case REGULAR : return GetRegularPatchSize();
case QUADS : return 4;
case TRIANGLES : return 3;
case LINES : return 2;
case POINTS : return 1;
case GREGORY_BASIS : assert(0); return GetGregoryBasisPatchSize();
case GREGORY :
case GREGORY_BOUNDARY : assert(0); // unsupported types
default : return -1;
}
} }
// Allows ordering of patches by type // Allows ordering of patches by type