Corrected some errors in the reflections Has*** functions

This commit is contained in:
Paolo Cignoni 2006-11-07 11:29:24 +00:00
parent 62244759fc
commit 865bb26e54
3 changed files with 57 additions and 1 deletions

View File

@ -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();}

View File

@ -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<typename T::FaceType const *>(this);

View File

@ -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<VALUE_TYPE> {
public:
vector_ocf():std::vector<VALUE_TYPE>(){
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<typename VALUE_TYPE::QualityType> QV;
std::vector<typename VALUE_TYPE::ColorType> CV;
std::vector<typename VALUE_TYPE::NormalType> NV;
std::vector<struct VFAdjType> AV;
bool QualityEnabled;
bool ColorEnabled;
bool NormalEnabled;
bool VFAdjacencyEnabled;
@ -220,6 +241,19 @@ public:
template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
///*-------------------------- QUALITY ----------------------------------*/
template <class A, class T> 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 T> class QualityfOcf: public QualityOcf<float, T> {};
///*-------------------------- 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