added Name(std:vector<std::string>& n) that fills n with the names of the attribute of the vertex type

This commit is contained in:
ganovelli 2007-02-12 19:00:56 +00:00
parent c2dcc2798f
commit bf964ff70c
2 changed files with 70 additions and 13 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.8 2006/09/28 17:34:11 cignoni
Added Missing GetBBox function
Revision 1.7 2006/02/27 17:42:43 ponchio Revision 1.7 2006/02/27 17:42:43 ponchio
Added some documentation. Added some documentation.
@ -78,6 +81,8 @@ class VertexTypeHolder{
typedef BET *EdgePointer; typedef BET *EdgePointer;
typedef BFT *FacePointer; typedef BFT *FacePointer;
typedef BTT *TetraPointer; typedef BTT *TetraPointer;
static void Name(std::vector<std::string> & name){}
}; };
/* The base class form which we start to add our components. /* The base class form which we start to add our components.
@ -238,7 +243,6 @@ static inline bool DeleteBitFlag(int bitval)
void GetBBox( BoxType & bb ) const void GetBBox( BoxType & bb ) const
{ bb.Set(this->P()); } { bb.Set(this->P()); }
}; };

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.19 2006/12/11 23:40:57 ganovelli
Has*Opt migrated to Has*Occ
Revision 1.18 2006/11/28 22:34:28 cignoni Revision 1.18 2006/11/28 22:34:28 cignoni
Added default constructor with null initialization to adjacency members. Added default constructor with null initialization to adjacency members.
AddFaces and AddVertices NEED to know if the topology is correctly computed to update it. AddFaces and AddVertices NEED to know if the topology is correctly computed to update it.
@ -85,6 +88,7 @@ First working version!
****************************************************************************/ ****************************************************************************/
#ifndef __VCG_VERTEX_PLUS_COMPONENT #ifndef __VCG_VERTEX_PLUS_COMPONENT
#define __VCG_VERTEX_PLUS_COMPONENT #define __VCG_VERTEX_PLUS_COMPONENT
#include <vector>
#include <vcg/space/point3.h> #include <vcg/space/point3.h>
#include <vcg/space/tcoord2.h> #include <vcg/space/tcoord2.h>
#include <vcg/space/color4.h> #include <vcg/space/color4.h>
@ -108,6 +112,7 @@ public:
const CoordType &cP() const { static CoordType coord(0, 0, 0); assert(0); return coord; } const CoordType &cP() const { static CoordType coord(0, 0, 0); assert(0); return coord; }
CoordType &UberP() { static CoordType coord(0, 0, 0); return coord; } CoordType &UberP() { static CoordType coord(0, 0, 0); return coord; }
static bool HasCoord() { return false; } static bool HasCoord() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);}
}; };
@ -121,11 +126,17 @@ public:
CoordType &UberP() { return _coord; } CoordType &UberP() { return _coord; }
static bool HasCoord() { return true; } static bool HasCoord() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord")));T::Name(name);}
private: private:
CoordType _coord; CoordType _coord;
}; };
template <class T> class Coord3f: public Coord<vcg::Point3f, T> {}; template <class T> class Coord3f: public Coord<vcg::Point3f, T> {
template <class T> class Coord3d: public Coord<vcg::Point3d, T> {}; public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord3f"));T::Name(name);}
};
template <class T> class Coord3d: public Coord<vcg::Point3d, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord3d"));T::Name(name);}
};
/*-------------------------- NORMAL ----------------------------------------*/ /*-------------------------- NORMAL ----------------------------------------*/
@ -136,6 +147,8 @@ public:
const NormalType cN()const { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; } const NormalType cN()const { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
static bool HasNormal() { return false; } static bool HasNormal() { return false; }
static bool HasNormalOcc() { return false; } static bool HasNormalOcc() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);}
}; };
template <class A, class T> class Normal: public T { template <class A, class T> class Normal: public T {
public: public:
@ -143,13 +156,21 @@ public:
NormalType &N() { return _norm; } NormalType &N() { return _norm; }
const NormalType &cN() const { return _norm; } const NormalType &cN() const { return _norm; }
static bool HasNormal() { return true; } static bool HasNormal() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal"));T::Name(name);}
private: private:
NormalType _norm; NormalType _norm;
}; };
template <class T> class Normal3s: public Normal<vcg::Point3s, T> {}; template <class T> class Normal3s: public Normal<vcg::Point3s, T> {
template <class T> class Normal3f: public Normal<vcg::Point3f, T> {}; public:static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3s"));T::Name(name);}
template <class T> class Normal3d: public Normal<vcg::Point3d, T> {}; };
template <class T> class Normal3f: public Normal<vcg::Point3f, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3f"));T::Name(name);}
};
template <class T> class Normal3d: public Normal<vcg::Point3d, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3d"));T::Name(name);}
};
/*-------------------------- INCREMENTAL MARK ----------------------------------------*/ /*-------------------------- INCREMENTAL MARK ----------------------------------------*/
@ -161,6 +182,7 @@ public:
inline void InitIMark() { } inline void InitIMark() { }
inline int & IMark() { assert(0); static int tmp=-1; return tmp;} inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
inline const int & IMark() const {return 0;} inline const int & IMark() const {return 0;}
static void Name(std::vector<std::string> & name){T::Name(name);}
}; };
template <class T> class Mark: public T { template <class T> class Mark: public T {
@ -170,6 +192,7 @@ public:
inline void InitIMark() { _imark = 0; } inline void InitIMark() { _imark = 0; }
inline int & IMark() { return _imark;} inline int & IMark() { return _imark;}
inline const int & IMark() const {return _imark;} inline const int & IMark() const {return _imark;}
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
private: private:
int _imark; int _imark;
@ -182,20 +205,30 @@ public:
typedef vcg::TCoord2<float,1> TextureType; typedef vcg::TCoord2<float,1> TextureType;
TextureType &T() { static TextureType dummy_texture; assert(0); return dummy_texture; } TextureType &T() { static TextureType dummy_texture; assert(0); return dummy_texture; }
static bool HasTexture() { return false; } static bool HasTexture() { return false; }
static void Name(std::vector<std::string> & name){TT::Name(name);}
}; };
template <class A, class TT> class Texture: public TT { template <class A, class TT> class Texture: public TT {
public: public:
typedef A TextureType; typedef A TextureType;
TextureType &T() { return _t; } TextureType &T() { return _t; }
static bool HasTexture() { return true; } static bool HasTexture() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Texture"));T::Name(name);}
private: private:
TextureType _t; TextureType _t;
}; };
template <class TT> class Texture2s: public Texture<TCoord2<short,1>, TT> {}; template <class TT> class Texture2s: public Texture<TCoord2<short,1>, TT> {
template <class TT> class Texture2f: public Texture<TCoord2<float,1>, TT> {}; static void Name(std::vector<std::string> & name){name.push_back(std::string("Texture2s"));TT::Name(name);}
template <class TT> class Texture2d: public Texture<TCoord2<double,1>, TT> {};
};
template <class TT> class Texture2f: public Texture<TCoord2<float,1>, TT> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("Texture2f"));TT::Name(name);}
};
template <class TT> class Texture2d: public Texture<TCoord2<double,1>, TT> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("Texture2d"));TT::Name(name);}
};
/*------------------------- FLAGS -----------------------------------------*/ /*------------------------- FLAGS -----------------------------------------*/
template <class T> class EmptyBitFlags: public T { template <class T> class EmptyBitFlags: public T {
@ -205,6 +238,7 @@ public:
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; } int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
const int Flags() const { return 0; } const int Flags() const { return 0; }
static bool HasFlags() { return false; } static bool HasFlags() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);}
}; };
@ -215,6 +249,7 @@ public:
int &Flags() {return _flags; } int &Flags() {return _flags; }
const int Flags() const {return _flags; } const int Flags() const {return _flags; }
static bool HasFlags() { return true; } static bool HasFlags() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
private: private:
int _flags; int _flags;
@ -227,6 +262,8 @@ public:
typedef vcg::Color4b ColorType; typedef vcg::Color4b ColorType;
ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
static bool HasColor() { return false; } static bool HasColor() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);}
}; };
template <class A, class T> class Color: public T { template <class A, class T> class Color: public T {
public: public:
@ -234,11 +271,15 @@ public:
typedef A ColorType; typedef A ColorType;
ColorType &C() { return _color; } ColorType &C() { return _color; }
static bool HasColor() { return true; } static bool HasColor() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
private: private:
ColorType _color; ColorType _color;
}; };
template <class T> class Color4b: public vert::Color<vcg::Color4b, T> {}; template <class T> class Color4b: public vert::Color<vcg::Color4b, T> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4b"));TT::Name(name);}
};
/*-------------------------- Quality ----------------------------------*/ /*-------------------------- Quality ----------------------------------*/
@ -247,20 +288,29 @@ public:
typedef float QualityType; typedef float QualityType;
QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; } QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
static bool HasQuality() { return false; } static bool HasQuality() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);}
}; };
template <class A, class T> class Quality: public T { template <class A, class T> class Quality: public T {
public: public:
typedef A QualityType; typedef A QualityType;
QualityType &Q() { return _quality; } QualityType &Q() { return _quality; }
static bool HasQuality() { return true; } static bool HasQuality() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
private: private:
QualityType _quality; QualityType _quality;
}; };
template <class T> class Qualitys: public Quality<short, T> {}; template <class T> class Qualitys: public Quality<short, T> {
template <class T> class Qualityf: public Quality<float, T> {}; static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualitys"));TT::Name(name);}
template <class T> class Qualityd: public Quality<double, T> {}; };
template <class T> class Qualityf: public Quality<float, T> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityf"));TT::Name(name);}
};
template <class T> class Qualityd: public Quality<double, T> {
static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityd"));TT::Name(name);}
};
/*----------------------------- VFADJ ------------------------------*/ /*----------------------------- VFADJ ------------------------------*/
@ -272,6 +322,7 @@ public:
int &VFi(){static int z=0; return z;}; int &VFi(){static int z=0; return z;};
static bool HasVFAdjacency() { return false; } static bool HasVFAdjacency() { return false; }
static bool HasVFAdjacencyOcc() { return false; } static bool HasVFAdjacencyOcc() { return false; }
static void Name(std::vector<std::string> & name){ T::Name(name);}
}; };
template <class T> class VFAdj: public T { template <class T> class VFAdj: public T {
@ -282,6 +333,8 @@ public:
int &VFi() {return _zp; } int &VFi() {return _zp; }
static bool HasVFAdjacency() { return true; } static bool HasVFAdjacency() { return true; }
static bool HasVFAdjacencyOcc() { return true; } static bool HasVFAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
private: private:
typename T::FacePointer _fp ; typename T::FacePointer _fp ;
int _zp ; int _zp ;