From 8111bcda24259fc16b8abeb956446286cef221c8 Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 6 Feb 2013 11:22:11 +0000 Subject: [PATCH] Corrected a very nasty bug introduced in Revision 4782 that reorganized ocf face component and added a standard interface for query the availabiilty of data: bool FaceType::IsXXXAvaialble() ,must be defined in the XXX ocf type and not in the info type otherwise it would be defined also for non ocf components. --- vcg/simplex/face/component_ocf.h | 21 +++++++++++++-------- vcg/simplex/vertex/component_ocf.h | 21 ++++++++++----------- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/vcg/simplex/face/component_ocf.h b/vcg/simplex/face/component_ocf.h index 40ea6484..bd3ed270 100644 --- a/vcg/simplex/face/component_ocf.h +++ b/vcg/simplex/face/component_ocf.h @@ -408,6 +408,11 @@ public: return (*this).Base().AV[(*this).Index()]._zp[j]; } + char cVFi(const int j) const { + assert((*this).Base().VFAdjacencyEnabled); + return (*this).Base().AV[(*this).Index()]._zp[j]; + } + template void ImportData(const RightFaceType & rightF){ T::ImportData(rightF); @@ -461,6 +466,7 @@ public: template class NormalOcf: public T { public: typedef A NormalType; + inline bool IsNormalEnabled( ) const { return this->Base().IsNormalEnabled(); } static bool HasNormal() { return true; } static bool HasNormalOcf() { return true; } @@ -501,6 +507,7 @@ public: typedef typename CurvatureDirType::VecType VecType; typedef typename CurvatureDirType::ScalarType ScalarType; + inline bool IsCurvatureDirEnabled( ) const { return this->Base().IsCurvatureDirEnabled(); } static bool HasCurvatureDir() { return true; } static bool HasCurvatureDirOcf() { return true; } @@ -584,6 +591,7 @@ public: Q() = rightF.cQ(); T::ImportData(rightF); } + inline bool IsQualityEnabled( ) const { return this->Base().IsQualityEnabled(); } static bool HasQuality() { return true; } static bool HasQualityOcf() { return true; } }; @@ -609,6 +617,7 @@ public: C() = rightF.cC(); T::ImportData(rightF); } + inline bool IsColorEnabled() const { return this->Base().IsColorEnabled();} static bool HasColor() { return true; } static bool HasColorOcf() { return true; } }; @@ -633,6 +642,7 @@ public: IMark() = rightF.cIMark(); T::ImportData(rightF); } + inline bool IsMarkEnabled( ) const { return this->Base().IsMarkEnabled(); } static bool HasMark() { return true; } static bool HasMarkOcf() { return true; } inline void InitIMark() { IMark() = 0; } @@ -651,6 +661,7 @@ public: { WT(0) = rightF.cWT(0); WT(1) = rightF.cWT(1); WT(2) = rightF.cWT(2); } TT::ImportData(rightF); } + inline bool IsWedgeTexCoordEnabled( ) const { return this->Base().IsWedgeTexCoordEnabled(); } static bool HasWedgeTexCoord() { return true; } static bool HasWedgeTexCoordOcf() { return true; } }; @@ -670,6 +681,7 @@ public: { WC(0) = rightF.cWC(0); WC(1) = rightF.cWC(1); WC(2) = rightF.cWC(2); } TT::ImportData(rightF); } + inline bool IsWedgeColorEnabled( ) const { return this->Base().IsWedgeColorEnabled(); } static bool HasWedgeColor() { return true; } static bool HasWedgeColorOcf() { return true; } }; @@ -689,6 +701,7 @@ public: { WN(0) = rightF.cWN(0); WN(1) = rightF.cWN(1); WN(2) = rightF.cWN(2); } TT::ImportData(rightF); } + inline bool IsWedgeNormalEnabled( ) const { return this->Base().IsWedgeNormalEnabled(); } static bool HasWedgeNormal() { return true; } static bool HasWedgeNormalOcf() { return true; } }; @@ -723,15 +736,7 @@ public: static bool HasFFAdjacencyOcf() { return false; } static bool HasVFAdjacencyOcf() { return false; } - inline bool IsColorEnabled() const { return _ovp->IsColorEnabled();} - inline bool IsCurvatureDirEnabled( ) const { return _ovp->IsCurvatureDirEnabled(); } - inline bool IsMarkEnabled( ) const { return _ovp->IsMarkEnabled(); } - inline bool IsNormalEnabled( ) const { return _ovp->IsNormalEnabled(); } - inline bool IsQualityEnabled( ) const { return _ovp->IsQualityEnabled(); } - inline bool IsWedgeColorEnabled( ) const { return _ovp->IsWedgeColorEnabled(); } - inline bool IsWedgeNormalEnabled( ) const { return _ovp->IsWedgeNormalEnabled(); } - inline bool IsWedgeTexCoordEnabled( ) const { return _ovp->IsWedgeTexCoordEnabled(); } diff --git a/vcg/simplex/vertex/component_ocf.h b/vcg/simplex/vertex/component_ocf.h index 769b74a4..1ef8636d 100644 --- a/vcg/simplex/vertex/component_ocf.h +++ b/vcg/simplex/vertex/component_ocf.h @@ -291,7 +291,7 @@ public: static bool HasVFAdjacency() { return true; } static bool HasVFAdjacencyOcf() { return true; } - static bool IsVFAdjacencyEnabled(const typename T::VertexType *vp) {return vp->Base().VFAdjacencyEnabled;} + bool IsVFAdjacencyEnabled(const typename T::VertexType *vp) {return vp->Base().VFAdjacencyEnabled;} static void Name(std::vector & name){name.push_back(std::string("VFAdjOcf"));T::Name(name);} private: @@ -302,6 +302,7 @@ private: template class NormalOcf: public T { public: typedef A NormalType; + inline bool IsNormalEnabled( ) const { return this->Base().IsNormalEnabled(); } static bool HasNormal() { return true; } static bool HasNormalOcf() { return true; } @@ -336,6 +337,7 @@ public: T::ImportData(rightV); } + inline bool IsColorEnabled() const { return this->Base().IsColorEnabled();} static bool HasColor() { return true; } static bool HasColorOcf() { assert(!T::HasColorOcf()); return true; } }; @@ -359,6 +361,7 @@ public: Q() = rightV.cQ(); T::ImportData(rightV); } + inline bool IsQualityEnabled( ) const { return this->Base().IsQualityEnabled(); } static bool HasQuality() { return true; } static bool HasQualityOcf() { assert(!T::HasQualityOcf()); return true; } }; @@ -383,6 +386,7 @@ public: T() = rightV.cT(); TT::ImportData(rightV); } + inline bool IsTexCoordEnabled( ) const { return this->Base().IsTexCoordEnabled(); } static bool HasTexCoord() { return true; } static bool HasTexCoordOcf() { assert(!TT::HasTexCoordOcf()); return true; } }; @@ -407,6 +411,7 @@ public: IMark() = rightV.cIMark(); T::ImportData(rightV); } + inline bool IsMarkEnabled( ) const { return this->Base().IsMarkEnabled(); } static bool HasMark() { return true; } static bool HasMarkOcf() { return true; } inline void InitIMark() { IMark() = 0; } @@ -437,6 +442,7 @@ public: TT::ImportData(rightV); } + inline bool IsCurvatureEnabled( ) const { return this->Base().IsCurvatureDirEnabled(); } static bool HasCurvature() { return true; } static bool HasCurvatureOcf() { return true; } }; @@ -484,6 +490,8 @@ public: } TT::ImportData(rightV); } + + inline bool IsCurvatureDirEnabled( ) const { return this->Base().IsCurvatureDirEnabled(); } static bool HasCurvatureDir() { return true; } static bool HasCurvatureDirOcf() { return true; } static void Name(std::vector & name){name.push_back(std::string("CurvatureDirOcf"));TT::Name(name);} @@ -516,6 +524,7 @@ public: TT::ImportData(rightV); } + inline bool IsRadiusEnabled( ) const { return this->Base().IsRadiusEnabled(); } static bool HasRadius() { return true; } static bool HasRadiusOcf() { return true; } static void Name(std::vector & name){name.push_back(std::string("RadiusOcf")); TT::Name(name);} @@ -554,16 +563,6 @@ public: static bool HasRadiusOcf() { return false; } static bool HasTexCoordOcf() { return false; } static bool HasVFAdjacencyOcf() { return false; } - - inline bool IsColorEnabled() const { return _ovp->IsColorEnabled();} - inline bool IsCurvatureEnabled( ) const { return _ovp->IsCurvatureDirEnabled(); } - inline bool IsCurvatureDirEnabled( ) const { return _ovp->IsCurvatureDirEnabled(); } - inline bool IsMarkEnabled( ) const { return _ovp->IsMarkEnabled(); } - inline bool IsNormalEnabled( ) const { return _ovp->IsNormalEnabled(); } - inline bool IsQualityEnabled( ) const { return _ovp->IsQualityEnabled(); } - inline bool IsRadiusEnabled( ) const { return _ovp->IsRadiusEnabled(); } - inline bool IsTexCoordEnabled( ) const { return _ovp->IsTexCoordEnabled(); } - };