Added zero initialization to quality component. (and corrected a small bug in the ocf quality component)
This commit is contained in:
parent
eeccd23f71
commit
df97ef0c36
|
|
@ -400,6 +400,7 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
|
||||||
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;
|
||||||
|
Quality():_quality(0) {}
|
||||||
QualityType &Q() { return _quality; }
|
QualityType &Q() { return _quality; }
|
||||||
QualityType cQ() const { return _quality; }
|
QualityType cQ() const { return _quality; }
|
||||||
template <class RightValueType>
|
template <class RightValueType>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
* \ *
|
* \ *
|
||||||
* All rights reserved. *
|
* All rights reserved. *
|
||||||
* *
|
* *
|
||||||
* This program is free software; you can redistribute it and/or modify *
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
* it under the terms of the GNU General Public License as published by *
|
* it under the terms of the GNU General Public License as published by *
|
||||||
* the Free Software Foundation; either version 2 of the License, or *
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
* (at your option) any later version. *
|
* (at your option) any later version. *
|
||||||
|
|
@ -35,9 +35,9 @@ All the Components that can be added to a faceex should be defined in the namesp
|
||||||
|
|
||||||
template <class VALUE_TYPE>
|
template <class VALUE_TYPE>
|
||||||
class vector_ocf: public std::vector<VALUE_TYPE> {
|
class vector_ocf: public std::vector<VALUE_TYPE> {
|
||||||
typedef std::vector<VALUE_TYPE> BaseType;
|
typedef std::vector<VALUE_TYPE> BaseType;
|
||||||
typedef typename vector_ocf<VALUE_TYPE>::iterator ThisTypeIterator;
|
typedef typename vector_ocf<VALUE_TYPE>::iterator ThisTypeIterator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
vector_ocf():std::vector<VALUE_TYPE>()
|
vector_ocf():std::vector<VALUE_TYPE>()
|
||||||
{
|
{
|
||||||
|
|
@ -52,32 +52,32 @@ public:
|
||||||
VFAdjacencyEnabled=false;
|
VFAdjacencyEnabled=false;
|
||||||
FFAdjacencyEnabled=false;
|
FFAdjacencyEnabled=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auxiliary types to build internal vectors
|
// Auxiliary types to build internal vectors
|
||||||
struct AdjTypePack {
|
struct AdjTypePack {
|
||||||
typename VALUE_TYPE::FacePointer _fp[3] ;
|
typename VALUE_TYPE::FacePointer _fp[3] ;
|
||||||
char _zp[3] ;
|
char _zp[3] ;
|
||||||
|
|
||||||
// Default constructor.
|
// Default constructor.
|
||||||
// Needed because we need to know if adjacency is initialized or not
|
// Needed because we need to know if adjacency is initialized or not
|
||||||
// when resizing vectors and during an allocate face.
|
// when resizing vectors and during an allocate face.
|
||||||
AdjTypePack() {
|
AdjTypePack() {
|
||||||
_fp[0]=0;
|
_fp[0]=0;
|
||||||
_fp[1]=0;
|
_fp[1]=0;
|
||||||
_fp[2]=0;
|
_fp[2]=0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//template <class TexCoordType>
|
//template <class TexCoordType>
|
||||||
class WedgeTexTypePack {
|
class WedgeTexTypePack {
|
||||||
public:
|
public:
|
||||||
WedgeTexTypePack() {
|
WedgeTexTypePack() {
|
||||||
wt[0].U()=.5;wt[0].V()=.5;
|
wt[0].U()=.5;wt[0].V()=.5;
|
||||||
wt[1].U()=.5;wt[1].V()=.5;
|
wt[1].U()=.5;wt[1].V()=.5;
|
||||||
wt[2].U()=.5;wt[2].V()=.5;
|
wt[2].U()=.5;wt[2].V()=.5;
|
||||||
wt[0].N()=-1;
|
wt[0].N()=-1;
|
||||||
wt[1].N()=-1;
|
wt[1].N()=-1;
|
||||||
wt[2].N()=-1;
|
wt[2].N()=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
typename VALUE_TYPE::TexCoordType wt[3];
|
typename VALUE_TYPE::TexCoordType wt[3];
|
||||||
|
|
@ -87,13 +87,13 @@ class WedgeColorTypePack {
|
||||||
public:
|
public:
|
||||||
WedgeColorTypePack() {
|
WedgeColorTypePack() {
|
||||||
typedef typename VALUE_TYPE::ColorType::ScalarType WedgeColorScalarType;
|
typedef typename VALUE_TYPE::ColorType::ScalarType WedgeColorScalarType;
|
||||||
for (int i=0; i<3; ++i)
|
for (int i=0; i<3; ++i)
|
||||||
{
|
{
|
||||||
wc[i][0] = WedgeColorScalarType(255);
|
wc[i][0] = WedgeColorScalarType(255);
|
||||||
wc[i][1] = WedgeColorScalarType(255);
|
wc[i][1] = WedgeColorScalarType(255);
|
||||||
wc[i][2] = WedgeColorScalarType(255);
|
wc[i][2] = WedgeColorScalarType(255);
|
||||||
wc[i][3] = WedgeColorScalarType(255);
|
wc[i][3] = WedgeColorScalarType(255);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typename VALUE_TYPE::ColorType wc[3];
|
typename VALUE_TYPE::ColorType wc[3];
|
||||||
|
|
@ -103,12 +103,12 @@ class WedgeNormalTypePack {
|
||||||
public:
|
public:
|
||||||
WedgeNormalTypePack() {
|
WedgeNormalTypePack() {
|
||||||
typedef typename VALUE_TYPE::NormalType::ScalarType WedgeNormalScalarType;
|
typedef typename VALUE_TYPE::NormalType::ScalarType WedgeNormalScalarType;
|
||||||
for (int i=0; i<3; ++i)
|
for (int i=0; i<3; ++i)
|
||||||
{
|
{
|
||||||
wn[i][0] = WedgeNormalScalarType(0);
|
wn[i][0] = WedgeNormalScalarType(0);
|
||||||
wn[i][1] = WedgeNormalScalarType(0);
|
wn[i][1] = WedgeNormalScalarType(0);
|
||||||
wn[i][2] = WedgeNormalScalarType(1);
|
wn[i][2] = WedgeNormalScalarType(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typename VALUE_TYPE::NormalType wn[3];
|
typename VALUE_TYPE::NormalType wn[3];
|
||||||
|
|
@ -121,55 +121,55 @@ public:
|
||||||
void push_back(const VALUE_TYPE & v)
|
void push_back(const VALUE_TYPE & v)
|
||||||
{
|
{
|
||||||
BaseType::push_back(v);
|
BaseType::push_back(v);
|
||||||
BaseType::back()._ovp = this;
|
BaseType::back()._ovp = this;
|
||||||
if (QualityEnabled) QV.push_back(0);
|
if (QualityEnabled) QV.push_back(0);
|
||||||
if (_ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
|
if (_ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
|
||||||
if (MarkEnabled) MV.push_back(0);
|
if (MarkEnabled) MV.push_back(0);
|
||||||
if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
|
if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
|
||||||
if (CurvatureDirEnabled) CDV.push_back(typename VALUE_TYPE::CurvatureDirType());
|
if (CurvatureDirEnabled) CDV.push_back(typename VALUE_TYPE::CurvatureDirType());
|
||||||
if (VFAdjacencyEnabled) AV.push_back(AdjTypePack());
|
if (VFAdjacencyEnabled) AV.push_back(AdjTypePack());
|
||||||
if (FFAdjacencyEnabled) AF.push_back(AdjTypePack());
|
if (FFAdjacencyEnabled) AF.push_back(AdjTypePack());
|
||||||
if (WedgeTexEnabled) WTV.push_back(WedgeTexTypePack());
|
if (WedgeTexEnabled) WTV.push_back(WedgeTexTypePack());
|
||||||
if (WedgeColorEnabled) WCV.push_back(WedgeColorTypePack());
|
if (WedgeColorEnabled) WCV.push_back(WedgeColorTypePack());
|
||||||
if (WedgeNormalEnabled) WNV.push_back(WedgeNormalTypePack());
|
if (WedgeNormalEnabled) WNV.push_back(WedgeNormalTypePack());
|
||||||
}
|
}
|
||||||
void pop_back();
|
void pop_back();
|
||||||
void resize(const unsigned int & _size)
|
void resize(const unsigned int & _size)
|
||||||
{
|
{
|
||||||
unsigned int oldsize = BaseType::size();
|
unsigned int oldsize = BaseType::size();
|
||||||
BaseType::resize(_size);
|
BaseType::resize(_size);
|
||||||
if(oldsize<_size){
|
if(oldsize<_size){
|
||||||
ThisTypeIterator firstnew = BaseType::begin();
|
ThisTypeIterator firstnew = BaseType::begin();
|
||||||
advance(firstnew,oldsize);
|
advance(firstnew,oldsize);
|
||||||
_updateOVP(firstnew,(*this).end());
|
_updateOVP(firstnew,(*this).end());
|
||||||
}
|
}
|
||||||
if (QualityEnabled) QV.resize(_size);
|
if (QualityEnabled) QV.resize(_size,0);
|
||||||
if (_ColorEnabled) CV.resize(_size);
|
if (_ColorEnabled) CV.resize(_size);
|
||||||
if (MarkEnabled) MV.resize(_size);
|
if (MarkEnabled) MV.resize(_size);
|
||||||
if (NormalEnabled) NV.resize(_size);
|
if (NormalEnabled) NV.resize(_size);
|
||||||
if (CurvatureDirEnabled)CDV.resize(_size);
|
if (CurvatureDirEnabled)CDV.resize(_size);
|
||||||
if (VFAdjacencyEnabled) AV.resize(_size);
|
if (VFAdjacencyEnabled) AV.resize(_size);
|
||||||
if (FFAdjacencyEnabled) AF.resize(_size);
|
if (FFAdjacencyEnabled) AF.resize(_size);
|
||||||
if (WedgeTexEnabled) WTV.resize(_size,WedgeTexTypePack());
|
if (WedgeTexEnabled) WTV.resize(_size,WedgeTexTypePack());
|
||||||
if (WedgeColorEnabled) WCV.resize(_size);
|
if (WedgeColorEnabled) WCV.resize(_size);
|
||||||
if (WedgeNormalEnabled) WNV.resize(_size);
|
if (WedgeNormalEnabled) WNV.resize(_size);
|
||||||
}
|
}
|
||||||
void reserve(const unsigned int & _size)
|
void reserve(const unsigned int & _size)
|
||||||
{
|
{
|
||||||
BaseType::reserve(_size);
|
BaseType::reserve(_size);
|
||||||
|
|
||||||
if (QualityEnabled) QV.reserve(_size);
|
if (QualityEnabled) QV.reserve(_size);
|
||||||
if (_ColorEnabled) CV.reserve(_size);
|
if (_ColorEnabled) CV.reserve(_size);
|
||||||
if (MarkEnabled) MV.reserve(_size);
|
if (MarkEnabled) MV.reserve(_size);
|
||||||
if (NormalEnabled) NV.reserve(_size);
|
if (NormalEnabled) NV.reserve(_size);
|
||||||
if (CurvatureDirEnabled)CDV.reserve(_size);
|
if (CurvatureDirEnabled)CDV.reserve(_size);
|
||||||
if (VFAdjacencyEnabled) AV.reserve(_size);
|
if (VFAdjacencyEnabled) AV.reserve(_size);
|
||||||
if (FFAdjacencyEnabled) AF.reserve(_size);
|
if (FFAdjacencyEnabled) AF.reserve(_size);
|
||||||
if (WedgeTexEnabled) WTV.reserve(_size);
|
if (WedgeTexEnabled) WTV.reserve(_size);
|
||||||
if (WedgeColorEnabled) WCV.reserve(_size);
|
if (WedgeColorEnabled) WCV.reserve(_size);
|
||||||
if (WedgeNormalEnabled) WNV.reserve(_size);
|
if (WedgeNormalEnabled) WNV.reserve(_size);
|
||||||
|
|
||||||
if( BaseType::empty()) return ;
|
if( BaseType::empty()) return ;
|
||||||
|
|
||||||
ThisTypeIterator oldbegin=(*this).begin();
|
ThisTypeIterator oldbegin=(*this).begin();
|
||||||
if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
|
if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
|
||||||
|
|
@ -182,9 +182,9 @@ public:
|
||||||
for(fi=lbegin;fi!=lend;++fi)
|
for(fi=lbegin;fi!=lend;++fi)
|
||||||
(*fi)._ovp=this;
|
(*fi)._ovp=this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// this function is called by the specialized Reorder function, that is called whenever someone call the allocator::CompactVertVector
|
// this function is called by the specialized Reorder function, that is called whenever someone call the allocator::CompactVertVector
|
||||||
void ReorderFace(std::vector<size_t> &newFaceIndex )
|
void ReorderFace(std::vector<size_t> &newFaceIndex )
|
||||||
{
|
{
|
||||||
|
|
@ -205,7 +205,7 @@ void ReorderFace(std::vector<size_t> &newFaceIndex )
|
||||||
if(newFaceIndex[i] != std::numeric_limits<size_t>::max() )
|
if(newFaceIndex[i] != std::numeric_limits<size_t>::max() )
|
||||||
{
|
{
|
||||||
assert(newFaceIndex[i] <= i);
|
assert(newFaceIndex[i] <= i);
|
||||||
if (QualityEnabled) QV[newFaceIndex[i]] = QV[i];
|
if (QualityEnabled) QV[newFaceIndex[i]] = QV[i];
|
||||||
if (_ColorEnabled) CV[newFaceIndex[i]] = CV[i];
|
if (_ColorEnabled) CV[newFaceIndex[i]] = CV[i];
|
||||||
if (MarkEnabled) MV[newFaceIndex[i]] = MV[i];
|
if (MarkEnabled) MV[newFaceIndex[i]] = MV[i];
|
||||||
if (NormalEnabled) NV[newFaceIndex[i]] = NV[i];
|
if (NormalEnabled) NV[newFaceIndex[i]] = NV[i];
|
||||||
|
|
@ -217,9 +217,9 @@ void ReorderFace(std::vector<size_t> &newFaceIndex )
|
||||||
if (WedgeNormalEnabled) WNV[newFaceIndex[i]] = WNV[i];
|
if (WedgeNormalEnabled) WNV[newFaceIndex[i]] = WNV[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (QualityEnabled) QV.resize(BaseType::size());
|
if (QualityEnabled) QV.resize(BaseType::size(),0);
|
||||||
if (_ColorEnabled) CV.resize(BaseType::size());
|
if (_ColorEnabled) CV.resize(BaseType::size());
|
||||||
if (MarkEnabled) MV.resize(BaseType::size());
|
if (MarkEnabled) MV.resize(BaseType::size());
|
||||||
if (NormalEnabled) NV.resize(BaseType::size());
|
if (NormalEnabled) NV.resize(BaseType::size());
|
||||||
if (CurvatureDirEnabled) CDV.resize(BaseType::size());
|
if (CurvatureDirEnabled) CDV.resize(BaseType::size());
|
||||||
|
|
@ -232,12 +232,12 @@ void ReorderFace(std::vector<size_t> &newFaceIndex )
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
// Enabling Functions
|
// Enabling Functions
|
||||||
|
|
||||||
bool IsQualityEnabled() const {return QualityEnabled;}
|
bool IsQualityEnabled() const {return QualityEnabled;}
|
||||||
void EnableQuality() {
|
void EnableQuality() {
|
||||||
assert(VALUE_TYPE::HasQualityOcf());
|
assert(VALUE_TYPE::HasQualityOcf());
|
||||||
QualityEnabled=true;
|
QualityEnabled=true;
|
||||||
QV.resize((*this).size());
|
QV.resize((*this).size(),0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisableQuality() {
|
void DisableQuality() {
|
||||||
|
|
@ -245,7 +245,7 @@ void DisableQuality() {
|
||||||
QualityEnabled=false;
|
QualityEnabled=false;
|
||||||
QV.clear();
|
QV.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsColorEnabled() const {return _ColorEnabled;}
|
bool IsColorEnabled() const {return _ColorEnabled;}
|
||||||
void EnableColor() {
|
void EnableColor() {
|
||||||
assert(VALUE_TYPE::HasColorOcf());
|
assert(VALUE_TYPE::HasColorOcf());
|
||||||
|
|
@ -390,22 +390,22 @@ public:
|
||||||
}; // end class vector_ocf
|
}; // end class vector_ocf
|
||||||
|
|
||||||
|
|
||||||
/*----------------------------- VFADJ ------------------------------*/
|
/*----------------------------- VFADJ ------------------------------*/
|
||||||
template <class T> class VFAdjOcf: public T {
|
template <class T> class VFAdjOcf: public T {
|
||||||
public:
|
public:
|
||||||
typename T::FacePointer &VFp(const int j) {
|
typename T::FacePointer &VFp(const int j) {
|
||||||
assert((*this).Base().VFAdjacencyEnabled);
|
assert((*this).Base().VFAdjacencyEnabled);
|
||||||
return (*this).Base().AV[(*this).Index()]._fp[j];
|
return (*this).Base().AV[(*this).Index()]._fp[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
typename T::FacePointer cVFp(const int j) const {
|
typename T::FacePointer cVFp(const int j) const {
|
||||||
if(! (*this).Base().VFAdjacencyEnabled ) return 0;
|
if(! (*this).Base().VFAdjacencyEnabled ) return 0;
|
||||||
else return (*this).Base().AV[(*this).Index()]._fp[j];
|
else return (*this).Base().AV[(*this).Index()]._fp[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
char &VFi(const int j) {
|
char &VFi(const int j) {
|
||||||
assert((*this).Base().VFAdjacencyEnabled);
|
assert((*this).Base().VFAdjacencyEnabled);
|
||||||
return (*this).Base().AV[(*this).Index()]._zp[j];
|
return (*this).Base().AV[(*this).Index()]._zp[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
char cVFi(const int j) const {
|
char cVFi(const int j) const {
|
||||||
|
|
@ -423,7 +423,7 @@ public:
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
/*----------------------------- FFADJ ------------------------------*/
|
/*----------------------------- FFADJ ------------------------------*/
|
||||||
template <class T> class FFAdjOcf: public T {
|
template <class T> class FFAdjOcf: public T {
|
||||||
public:
|
public:
|
||||||
typename T::FacePointer &FFp(const int j) {
|
typename T::FacePointer &FFp(const int j) {
|
||||||
|
|
@ -462,7 +462,7 @@ public:
|
||||||
static bool HasFFAdjacencyOcf() { return true; }
|
static bool HasFFAdjacencyOcf() { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*------------------------- Normal -----------------------------------------*/
|
/*------------------------- Normal -----------------------------------------*/
|
||||||
template <class A, class T> class NormalOcf: public T {
|
template <class A, class T> class NormalOcf: public T {
|
||||||
public:
|
public:
|
||||||
typedef A NormalType;
|
typedef A NormalType;
|
||||||
|
|
@ -572,7 +572,7 @@ template <class T> class CurvatureDirdOcf: public CurvatureDirOcf<CurvatureDirOc
|
||||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirdOcf"));T::Name(name);}
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirdOcf"));T::Name(name);}
|
||||||
};
|
};
|
||||||
|
|
||||||
///*-------------------------- QUALITY ----------------------------------*/
|
///*-------------------------- QUALITY ----------------------------------*/
|
||||||
template <class A, class T> class QualityOcf: public T {
|
template <class A, class T> class QualityOcf: public T {
|
||||||
public:
|
public:
|
||||||
typedef A QualityType;
|
typedef A QualityType;
|
||||||
|
|
@ -598,7 +598,7 @@ public:
|
||||||
|
|
||||||
template <class T> class QualityfOcf: public QualityOcf<float, T> {};
|
template <class T> class QualityfOcf: public QualityOcf<float, T> {};
|
||||||
|
|
||||||
///*-------------------------- COLOR ----------------------------------*/
|
///*-------------------------- COLOR ----------------------------------*/
|
||||||
template <class A, class T> class ColorOcf: public T {
|
template <class A, class T> class ColorOcf: public T {
|
||||||
public:
|
public:
|
||||||
typedef A ColorType;
|
typedef A ColorType;
|
||||||
|
|
@ -624,7 +624,7 @@ public:
|
||||||
|
|
||||||
template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
|
template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
|
||||||
|
|
||||||
///*-------------------------- MARK ----------------------------------*/
|
///*-------------------------- MARK ----------------------------------*/
|
||||||
template <class T> class MarkOcf: public T {
|
template <class T> class MarkOcf: public T {
|
||||||
public:
|
public:
|
||||||
inline int &IMark() {
|
inline int &IMark() {
|
||||||
|
|
@ -648,7 +648,7 @@ public:
|
||||||
inline void InitIMark() { IMark() = 0; }
|
inline void InitIMark() { IMark() = 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
///*-------------------------- WEDGE TEXCOORD ----------------------------------*/
|
///*-------------------------- WEDGE TEXCOORD ----------------------------------*/
|
||||||
template <class A, class TT> class WedgeTexCoordOcf: public TT {
|
template <class A, class TT> class WedgeTexCoordOcf: public TT {
|
||||||
public:
|
public:
|
||||||
WedgeTexCoordOcf(){ }
|
WedgeTexCoordOcf(){ }
|
||||||
|
|
@ -755,7 +755,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace face
|
} // end namespace face
|
||||||
|
|
||||||
template < class, class,class,class > class TriMesh;
|
template < class, class,class,class > class TriMesh;
|
||||||
|
|
||||||
namespace tri
|
namespace tri
|
||||||
|
|
|
||||||
|
|
@ -332,6 +332,8 @@ The Quality Component is a generic place for storing a float. The term 'quality'
|
||||||
template <class A, class TT> class Quality: public TT {
|
template <class A, class TT> class Quality: public TT {
|
||||||
public:
|
public:
|
||||||
typedef A QualityType;
|
typedef A QualityType;
|
||||||
|
Quality():_quality(0) {}
|
||||||
|
|
||||||
inline const QualityType &Q() const { return _quality; }
|
inline const QualityType &Q() const { return _quality; }
|
||||||
inline QualityType &Q() { return _quality; }
|
inline QualityType &Q() { return _quality; }
|
||||||
inline QualityType cQ() const {return _quality; }
|
inline QualityType cQ() const {return _quality; }
|
||||||
|
|
|
||||||
|
|
@ -63,20 +63,21 @@ public:
|
||||||
// All the standard methods of std::vector that can change the reallocation are
|
// All the standard methods of std::vector that can change the reallocation are
|
||||||
// redefined in order to manage the additional data.
|
// redefined in order to manage the additional data.
|
||||||
void push_back(const VALUE_TYPE & v)
|
void push_back(const VALUE_TYPE & v)
|
||||||
{
|
{
|
||||||
BaseType::push_back(v);
|
BaseType::push_back(v);
|
||||||
BaseType::back()._ovp = this;
|
BaseType::back()._ovp = this;
|
||||||
if (ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
|
if (ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
|
||||||
if (MarkEnabled) MV.push_back(0);
|
if (QualityEnabled) QV.push_back(0);
|
||||||
if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
|
if (MarkEnabled) MV.push_back(0);
|
||||||
if (TexCoordEnabled) TV.push_back(typename VALUE_TYPE::TexCoordType());
|
if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
|
||||||
if (VFAdjacencyEnabled) AV.push_back(VFAdjType());
|
if (TexCoordEnabled) TV.push_back(typename VALUE_TYPE::TexCoordType());
|
||||||
if (CurvatureEnabled) CuV.push_back(typename VALUE_TYPE::CurvatureType());
|
if (VFAdjacencyEnabled) AV.push_back(VFAdjType());
|
||||||
if (CurvatureDirEnabled) CuDV.push_back(typename VALUE_TYPE::CurvatureDirType());
|
if (CurvatureEnabled) CuV.push_back(typename VALUE_TYPE::CurvatureType());
|
||||||
if (RadiusEnabled) RadiusV.push_back(typename VALUE_TYPE::RadiusType());
|
if (CurvatureDirEnabled) CuDV.push_back(typename VALUE_TYPE::CurvatureDirType());
|
||||||
}
|
if (RadiusEnabled) RadiusV.push_back(typename VALUE_TYPE::RadiusType());
|
||||||
|
}
|
||||||
|
|
||||||
void pop_back();
|
void pop_back();
|
||||||
|
|
||||||
void resize(const unsigned int & _size)
|
void resize(const unsigned int & _size)
|
||||||
{
|
{
|
||||||
|
|
@ -88,6 +89,7 @@ public:
|
||||||
_updateOVP(firstnew,(*this).end());
|
_updateOVP(firstnew,(*this).end());
|
||||||
}
|
}
|
||||||
if (ColorEnabled) CV.resize(_size);
|
if (ColorEnabled) CV.resize(_size);
|
||||||
|
if (QualityEnabled) QV.resize(_size,0);
|
||||||
if (MarkEnabled) MV.resize(_size);
|
if (MarkEnabled) MV.resize(_size);
|
||||||
if (NormalEnabled) NV.resize(_size);
|
if (NormalEnabled) NV.resize(_size);
|
||||||
if (TexCoordEnabled) TV.resize(_size);
|
if (TexCoordEnabled) TV.resize(_size);
|
||||||
|
|
@ -101,6 +103,7 @@ public:
|
||||||
{
|
{
|
||||||
BaseType::reserve(_size);
|
BaseType::reserve(_size);
|
||||||
if (ColorEnabled) CV.reserve(_size);
|
if (ColorEnabled) CV.reserve(_size);
|
||||||
|
if (QualityEnabled) QV.reserve(_size);
|
||||||
if (MarkEnabled) MV.reserve(_size);
|
if (MarkEnabled) MV.reserve(_size);
|
||||||
if (NormalEnabled) NV.reserve(_size);
|
if (NormalEnabled) NV.reserve(_size);
|
||||||
if (TexCoordEnabled) TV.reserve(_size);
|
if (TexCoordEnabled) TV.reserve(_size);
|
||||||
|
|
@ -124,7 +127,7 @@ bool IsQualityEnabled() const {return QualityEnabled;}
|
||||||
void EnableQuality() {
|
void EnableQuality() {
|
||||||
assert(VALUE_TYPE::HasQualityOcf());
|
assert(VALUE_TYPE::HasQualityOcf());
|
||||||
QualityEnabled=true;
|
QualityEnabled=true;
|
||||||
QV.resize((*this).size());
|
QV.resize((*this).size(),0);
|
||||||
}
|
}
|
||||||
void DisableQuality() {
|
void DisableQuality() {
|
||||||
assert(VALUE_TYPE::HasQualityOcf());
|
assert(VALUE_TYPE::HasQualityOcf());
|
||||||
|
|
@ -285,9 +288,9 @@ public:
|
||||||
}
|
}
|
||||||
template <class RightVertexType>
|
template <class RightVertexType>
|
||||||
void ImportData(const RightVertexType & rightV)
|
void ImportData(const RightVertexType & rightV)
|
||||||
{
|
{
|
||||||
T::ImportData(rightV);
|
T::ImportData(rightV);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool HasVFAdjacency() { return true; }
|
static bool HasVFAdjacency() { return true; }
|
||||||
static bool HasVFAdjacencyOcf() { return true; }
|
static bool HasVFAdjacencyOcf() { return true; }
|
||||||
|
|
@ -538,11 +541,11 @@ template <class T> class RadiusdOcf: public RadiusOcf<double, T> {};
|
||||||
|
|
||||||
template < class T> class InfoOcf: public T {
|
template < class T> class InfoOcf: public T {
|
||||||
public:
|
public:
|
||||||
// You should never ever try to copy a vertex that has OCF stuff.
|
// You should never ever try to copy a vertex that has OCF stuff.
|
||||||
// use ImportData function.
|
// use ImportData function.
|
||||||
inline InfoOcf &operator=(const InfoOcf & /*other*/) {
|
inline InfoOcf &operator=(const InfoOcf & /*other*/) {
|
||||||
assert(0); return *this;
|
assert(0); return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector_ocf<typename T::VertexType> &Base() const { return *_ovp;}
|
vector_ocf<typename T::VertexType> &Base() const { return *_ovp;}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue