diff --git a/vcg/complex/trimesh/base.h b/vcg/complex/trimesh/base.h index 03e2edc3..500badc5 100644 --- a/vcg/complex/trimesh/base.h +++ b/vcg/complex/trimesh/base.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.23 2006/10/27 11:08:18 ganovelli +added override to HasFFAdjacency , HasVFAdjacency for the optional attributes (see also complex/trimesh/allocate.h) + Revision 1.22 2006/07/10 14:26:22 cignoni Minor. Added a disambiguating this at the constructor of trimesh @@ -313,6 +316,9 @@ ScalarType Volume() }; // end class Mesh +template < class VertContainerType, class FaceContainerType > +bool HasPerVertexQuality (const TriMesh < VertContainerType , FaceContainerType> & /*m*/) {return VertContainerType::value_type::HasQuality();} + template < class VertContainerType, class FaceContainerType > bool HasPerWedgeTexture (const TriMesh < VertContainerType , FaceContainerType> & /*m*/) {return FaceContainerType::value_type::HasWedgeTexture();} diff --git a/vcg/simplex/faceplus/component_ocf.h b/vcg/simplex/faceplus/component_ocf.h index 77073d46..78153d37 100644 --- a/vcg/simplex/faceplus/component_ocf.h +++ b/vcg/simplex/faceplus/component_ocf.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.17 2006/10/31 16:02:18 ganovelli +vesione 2005 compliant + Revision 1.16 2006/10/27 14:15:10 ganovelli added overrides to HasFFAddAdjacency and HasVFAddAdjacency @@ -430,6 +433,8 @@ public: static bool HasFaceNormalOcf() { return false; } static bool HasFaceMarkOcf() { return false; } static bool HasWedgeTextureOcf() { return false; } + static bool HasFFAdjacencyOcf() { return false; } + static bool HasVFAdjacencyOcf() { return false; } inline int Index() const { typename T::FaceType const *tp=static_cast(this); diff --git a/vcg/simplex/vertexplus/component_ocf.h b/vcg/simplex/vertexplus/component_ocf.h index be097a07..a00751d9 100644 --- a/vcg/simplex/vertexplus/component_ocf.h +++ b/vcg/simplex/vertexplus/component_ocf.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.4 2006/10/31 16:02:59 ganovelli +vesione 2005 compliant + Revision 1.3 2006/02/28 11:59:55 ponchio g++ compliance: @@ -66,6 +69,7 @@ class vector_ocf: public std::vector { public: vector_ocf():std::vector(){ + QualityEnabled=false; ColorEnabled=false; NormalEnabled=false; VFAdjacencyEnabled=false; @@ -107,6 +111,20 @@ public: //////////////////////////////////////// // Enabling Eunctions +bool IsQualityEnabled() const {return QualityEnabled;} +void EnableQuality() { + assert(VALUE_TYPE::HasQualityOcf()); + QualityEnabled=true; + QV.resize((*this).size()); +} + +void DisableQuality() { + assert(VALUE_TYPE::HasQualityOcf()); + QualityEnabled=false; + QV.clear(); +} + +bool IsColorEnabled() const {return ColorEnabled;} void EnableColor() { assert(VALUE_TYPE::HasColorOcf()); ColorEnabled=true; @@ -119,6 +137,7 @@ void DisableColor() { CV.clear(); } +bool IsNormalEnabled() const {return NormalEnabled;} void EnableNormal() { assert(VALUE_TYPE::HasNormalOcf()); NormalEnabled=true; @@ -152,10 +171,12 @@ struct VFAdjType { }; public: + std::vector QV; std::vector CV; std::vector NV; std::vector AV; + bool QualityEnabled; bool ColorEnabled; bool NormalEnabled; bool VFAdjacencyEnabled; @@ -220,6 +241,19 @@ public: template class Color4bOcf: public ColorOcf {}; +///*-------------------------- QUALITY ----------------------------------*/ + +template class QualityOcf: public T { +public: + typedef A QualityType; + QualityType &Q() { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()()]; } + static bool HasQuality() { return true; } + static bool HasQualityOcf() { return true; } +}; + +template class QualityfOcf: public QualityOcf {}; + + ///*-------------------------- InfoOpt ----------------------------------*/ template < class T> class InfoOcf: public T { @@ -236,6 +270,17 @@ public: }; - } // end namespace vert +} // end namespace vert + +namespace tri +{ + template < class VertType, class FaceContainerType > + bool HasPerVertexQuality (const TriMesh < vert::vector_ocf< VertType > , FaceContainerType > & m) + { + if(VertType::HasQualityOcf()) return m.vert.IsQualityEnabled(); + else return VertexType::HasQuality(); + } + +} }// end namespace vcg #endif