re-Added to all the data members of vertex the const access member

This commit is contained in:
Paolo Cignoni 2012-11-27 12:16:16 +00:00
parent fca284d27c
commit 3fb4e6d061
2 changed files with 54 additions and 36 deletions

View File

@ -147,6 +147,7 @@ template <class A, class T> class Coord: public T {
public:
typedef A CoordType;
typedef typename A::ScalarType ScalarType;
inline const CoordType &P() const { return _coord; }
inline CoordType &P() { return _coord; }
inline CoordType cP() const { return _coord; }
@ -174,6 +175,7 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class T> class Normal: public T {
public:
typedef A NormalType;
inline const NormalType &N() const { return _norm; }
inline NormalType &N() { return _norm; }
inline NormalType cN() const { return _norm; }
template < class RightValueType>
@ -207,8 +209,9 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class T> class Mark: public T {
public:
inline int cIMark() const { return _imark;}
inline const int &IMark() const { return _imark;}
inline int &IMark() { return _imark;}
inline int cIMark() const { return _imark;}
static bool HasMark() { return true; }
inline void InitIMark() { _imark = 0; }
template < class RightValueType>
@ -230,6 +233,7 @@ public:
template <class A, class TT> class TexCoord: public TT {
public:
typedef A TexCoordType;
const TexCoordType &T() const { return _t; }
TexCoordType &T() { return _t; }
TexCoordType cT() const { return _t; }
template < class RightValueType>
@ -261,6 +265,7 @@ template <class T> class BitFlags: public T {
public:
BitFlags(){_flags=0;}
typedef int FlagType;
inline const int &Flags() const {return _flags; }
inline int &Flags() {return _flags; }
inline int cFlags() const {return _flags; }
template < class RightValueType>
@ -283,6 +288,7 @@ template <class A, class T> class Color: public T {
public:
Color():_color(vcg::Color4b::White) {}
typedef A ColorType;
inline const ColorType &C() const { return _color; }
inline ColorType &C() { return _color; }
inline ColorType cC() const { return _color; }
template < class RightValueType>
@ -310,6 +316,7 @@ The Quality Component is a generic place for storing a float. The term 'quality'
template <class A, class TT> class Quality: public TT {
public:
typedef A QualityType;
inline const QualityType &Q() const { return _quality; }
inline QualityType &Q() { return _quality; }
inline QualityType cQ() const {return _quality; }
template < class RightValueType>
@ -340,6 +347,8 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
public:
typedef Point2<A> CurvatureType;
typedef typename CurvatureType::ScalarType ScalarType;
const ScalarType &Kh() const { return _hk[0];}
const ScalarType &Kg() const { return _hk[1];}
ScalarType &Kh() { return _hk[0];}
ScalarType &Kg() { return _hk[1];}
ScalarType cKh() const { return _hk[0];}
@ -368,6 +377,8 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
public:
typedef CurvatureDirBaseType<float> CurvatureDirType;
const Point3f &PD1() const { static Point3f dummy(0,0,0); return dummy;}
const Point3f &PD2() const { static Point3f dummy(0,0,0); return dummy;}
Point3f &PD1() { static Point3f dummy(0,0,0); return dummy;}
Point3f &PD2() { static Point3f dummy(0,0,0); return dummy;}
Point3f cPD1() const { static Point3f dummy(0,0,0); return dummy;}
@ -435,6 +446,7 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class TT> class Radius: public TT {
public:
typedef A RadiusType;
const RadiusType &R() const { return _radius; }
RadiusType &R() { return _radius; }
RadiusType cR() const {return _radius; }
template < class RightValueType>

View File

@ -305,6 +305,7 @@ public:
static bool HasNormal() { return true; }
static bool HasNormalOcf() { return true; }
const NormalType &N() const { assert((*this).Base().NormalEnabled); return (*this).Base().NV[(*this).Index()]; }
NormalType &N() { assert((*this).Base().NormalEnabled); return (*this).Base().NV[(*this).Index()]; }
NormalType cN() const { assert((*this).Base().NormalEnabled); return (*this).Base().NV[(*this).Index()]; }
@ -324,6 +325,7 @@ template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {public:
template <class A, class T> class ColorOcf: public T {
public:
typedef A ColorType;
const ColorType &C() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
ColorType &C() { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
ColorType cC() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
template <class LeftV>
@ -347,6 +349,7 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class T> class QualityOcf: public T {
public:
typedef A QualityType;
const QualityType &Q() const { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
QualityType &Q() { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
QualityType cQ() const { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
template <class LeftV>
@ -370,6 +373,7 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class TT> class TexCoordOcf: public TT {
public:
typedef A TexCoordType;
const TexCoordType &T() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
TexCoordType &T() { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
TexCoordType cT() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
template < class LeftV>
@ -392,6 +396,7 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class T> class MarkOcf: public T {
public:
typedef int MarkType;
inline const int &IMark() const { assert((*this).Base().MarkEnabled); return (*this).Base().MV[(*this).Index()]; }
inline int &IMark() { assert((*this).Base().MarkEnabled); return (*this).Base().MV[(*this).Index()]; }
inline int cIMark() const { assert((*this).Base().MarkEnabled); return (*this).Base().MV[(*this).Index()]; }
@ -499,6 +504,7 @@ public:
typedef A RadiusType;
typedef RadiusType ScalarType;
const RadiusType &R() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
RadiusType &R() { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
RadiusType cR() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}