From 71b34e6b95cd6e16b44fb1bc28dccc99b9af4d2a Mon Sep 17 00:00:00 2001 From: cignoni Date: Fri, 14 Oct 2005 13:30:07 +0000 Subject: [PATCH] Added constant access functions and reflective functions (HasSomething stuff) to all the components This is the first really working version... --- vcg/simplex/vertexplus/component.h | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/vcg/simplex/vertexplus/component.h b/vcg/simplex/vertexplus/component.h index 9743f4c1..e3e3ead1 100644 --- a/vcg/simplex/vertexplus/component.h +++ b/vcg/simplex/vertexplus/component.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.8 2005/10/07 15:19:54 cignoni +minor updates to keep it in line with the rest of the library + Revision 1.7 2004/05/10 13:50:32 cignoni Updated names of adj functions to the new standards @@ -68,6 +71,8 @@ public: const CoordType &P() const { static CoordType coord(0, 0, 0); return coord; } const CoordType &cP() const { static CoordType coord(0, 0, 0); return coord; } CoordType &UberP() { static CoordType coord(0, 0, 0); return coord; } + static bool HasCoord() { return false; } + }; template class Coord: public T { @@ -78,6 +83,8 @@ public: const CoordType &P() const { return _coord; } const CoordType &cP() const { return _coord; } CoordType &UberP() { return _coord; } + + static bool HasCoord() { return true; } private: CoordType _coord; }; @@ -90,12 +97,15 @@ template class EmptyNormal: public T { public: typedef vcg::Point3s NormalType; NormalType &N() { static NormalType dummy_normal(0, 0, 0); return dummy_normal; } + const NormalType cN()const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; } static bool HasNormal() { return false; } + static bool HasNormalOpt() { return false; } }; template class Normal: public T { public: typedef A NormalType; NormalType &N() { return _norm; } + const NormalType cN() const { return _norm; } static bool HasNormal() { return true; } private: NormalType _norm; @@ -112,6 +122,8 @@ public: typedef vcg::TCoord2 TextureType; TextureType &T() { static TextureType dummy_texture; return dummy_texture; } static bool HasTexture() { return false; } + static bool HasTextureOpt() { return false; } + }; template class Texture: public TT { public: @@ -130,15 +142,20 @@ template class Texture2d: public Texture, TT> {}; /*------------------------- FLAGS -----------------------------------------*/ template class EmptyFlag: public T { public: - /// Return the vector of Flags(), senza effettuare controlli sui bit + typedef int FlagType; + /// Return the vector of Flags(), senza effettuare controlli sui bit int &Flags() { static int dummyflags(0); return dummyflags; } const int Flags() const { return 0; } + static bool HasFlag() { return false; } + }; template class Flag: public T { public: - int &Flags() {return _flags; } - const int Flags() const {return _flags; } + typedef int FlagType; + int &Flags() {return _flags; } + const int Flags() const {return _flags; } + static bool HasFlag() { return true; } private: int _flags; @@ -191,15 +208,19 @@ template class Qualityd: public Quality {}; template class EmptyVFAdj: public T { public: typename T::FacePointer &VFp() { static typename T::FacePointer fp=0; return fp; } + typename T::FacePointer cVFp() { static typename T::FacePointer fp=0; return fp; } int &VFi(){static int z=0; return z;}; static bool HasVFAdjacency() { return false; } + static bool HasVFAdjacencyOpt() { return false; } }; template class VFAdj: public T { public: typename T::FacePointer &VFp() {return _fp; } + typename T::FacePointer cVFp() {return _fp; } int &VFi() {return _zp; } static bool HasVFAdjacency() { return true; } + static bool HasVFAdjacencyOpt() { return false; } private: typename T::FacePointer _fp ; int _zp ;