aggiunte funzioni di override per Has*

This commit is contained in:
ganovelli 2006-12-04 10:59:15 +00:00
parent aa10ac62be
commit 480c16bbfe
1 changed files with 62 additions and 8 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.3 2006/06/08 20:32:10 ganovelli
aggiunte wedge coord
Revision 1.2 2005/10/18 14:27:22 ganovelli Revision 1.2 2005/10/18 14:27:22 ganovelli
EdgePLaneType added (_RT) EdgePLaneType added (_RT)
@ -55,7 +58,7 @@ namespace vcg {
template <class A, class T> class WedgeTextureOcc: public T { template <class A, class T> class WedgeTextureOcc: public T {
public: public:
typedef A WedgeTextureType; typedef A WedgeTextureType;
WedgeTextureType &N() {return CAT< vector_occ<FaceType>,WedgeTextureType>::Instance()->Get((FaceType*)this);} WedgeTextureType &WT(const int&i) {return CAT< vector_occ<FaceType>,WedgeTextureType>::Instance()->Get((FaceType*)this);}
static bool HasWedgeTexture() { return true; } static bool HasWedgeTexture() { return true; }
static bool HasWedgeTextureOcc() { return true; } static bool HasWedgeTextureOcc() { return true; }
}; };
@ -80,22 +83,33 @@ namespace vcg {
public: public:
typedef A NormalType; typedef A NormalType;
NormalType &N() {return CAT< vector_occ<FaceType>,NormalType>::Instance()->Get((FaceType*)this);} NormalType &N() {return CAT< vector_occ<FaceType>,NormalType>::Instance()->Get((FaceType*)this);}
static bool HasNormal() { return true; } static bool HasFaceNormal() { return true; }
static bool HasColorOcc() { return true; } static bool HasFaceNormalOcc() { return true; }
}; };
template <class T> class Normal3sOcc: public NormalOcc<vcg::Point3s, T> {}; template <class T> class Normal3sOcc: public NormalOcc<vcg::Point3s, T> {};
template <class T> class Normal3fOcc: public NormalOcc<vcg::Point3f, T> {}; template <class T> class Normal3fOcc: public NormalOcc<vcg::Point3f, T> {};
template <class T> class Normal3dOcc: public NormalOcc<vcg::Point3d, T> {}; template <class T> class Normal3dOcc: public NormalOcc<vcg::Point3d, T> {};
///*-------------------------- MARK ----------------------------------------*/
template <class T> class MarkOcc: public T {
public:
typedef int MarkType;
int &IMark() {return CAT< vector_occ<FaceType>,MarkType>::Instance()->Get((MarkType*)this);}
static bool HasFaceMark() { return true; }
static bool HasFaceMarkOcc() { return true; }
inline void InitIMark() { IMark() = 0; }
};
///*-------------------------- COLOR ----------------------------------------*/ ///*-------------------------- COLOR ----------------------------------------*/
template <class A, class T> class ColorOcc: public T { template <class A, class T> class ColorOcc: public T {
public: public:
typedef A ColorType; typedef A ColorType;
ColorType &C() { return CAT< vector_occ<FaceType>,ColorType>::Instance()->Get((FaceType*)this); } ColorType &C() { return CAT< vector_occ<FaceType>,ColorType>::Instance()->Get((FaceType*)this); }
static bool HasColor() { return true; } static bool HasFaceColor() { return true; }
static bool HasColorOcc() { return true; } static bool HasfaceColorOcc() { return true; }
}; };
template <class T> class Color4bOcc: public ColorOcc<vcg::Color4b, T> {}; template <class T> class Color4bOcc: public ColorOcc<vcg::Color4b, T> {};
@ -112,6 +126,7 @@ struct VFAdjTypeSup {
template <class A, class T> class VFAdjOccBase: public T { template <class A, class T> class VFAdjOccBase: public T {
public: public:
typedef A VFAdjType;
typename T::FacePointer &VFp(const int j) { typename T::FacePointer &VFp(const int j) {
return (CAT< vector_occ<FaceType>,VFAdjTypeSup<T::FacePointer> >::Instance()->Get((FaceType*)this))._vfp[j];} return (CAT< vector_occ<FaceType>,VFAdjTypeSup<T::FacePointer> >::Instance()->Get((FaceType*)this))._vfp[j];}
@ -243,8 +258,47 @@ public:
inline const typename T::VertexType * const & UberV( const int j ) const { assert(j>=0 && j<3); return v[j]; } inline const typename T::VertexType * const & UberV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
static bool HasVertexRef() { return true; } static bool HasVertexRef() { return true; }
}; };
} // end namespace face } // end namespace face
template < class, class > class TriMesh;
namespace tri
{
template < class VertContainerType, class FaceType >
bool HasVFAdjacency (const TriMesh < VertContainerType , vector_occ< FaceType > > & m)
{
if(FaceType::HasVFAdjacencyOcc()) return m.face.IsEnabledAttribute<FaceType::VFAdjType >();
else return FaceType::FaceType::HasVFAdjacency();
}
template < class VertContainerType, class FaceType >
bool HasFFAdjacency (const TriMesh < VertContainerType , vector_occ< FaceType > > & m)
{
if(FaceType::HasFFAdjacencyOcc()) return m.face.IsEnabledAttribute<FaceType::FFAdjType >();
else return FaceType::FaceType::HasFFAdjacency();
}
template < class VertContainerType, class FaceType >
bool HasPerWedgeTexture (const TriMesh < VertContainerType , vector_occ< FaceType > > & m)
{
if(FaceType::HasWedgeTextureOcc()) return m.face.IsEnabledAttribute<FaceType::WedgeTextureType >();
else return FaceType::FaceType::HasWedgeTexture();
}
template < class VertContainerType, class FaceType >
bool HasPerFaceColor (const TriMesh < VertContainerType , vector_occ< FaceType > > & m)
{
if(FaceType::HasFaceColorOcc()) return m.face.IsEnabledAttribute<FaceType::ColorType>();
else return FaceType::FaceType::HasFaceColor();
}
template < class VertContainerType, class FaceType >
bool HasPerFaceMark (const TriMesh < VertContainerType , vector_occ< FaceType > > & m)
{
if(FaceType::HasFaceMarkOcc()) return m.face.IsEnabledAttribute<FaceType::MarkType>();
else return FaceType::FaceType::HasFaceMark();
}
}; // end namesace tri
}// end namespace vcg }// end namespace vcg
#endif #endif