Added zero initialization to quality component. (and corrected a small bug in the ocf quality component)

This commit is contained in:
Paolo Cignoni 2013-09-24 13:55:23 +00:00
parent eeccd23f71
commit df97ef0c36
4 changed files with 106 additions and 100 deletions

View File

@ -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 {
public:
typedef A QualityType;
Quality():_quality(0) {}
QualityType &Q() { return _quality; }
QualityType cQ() const { return _quality; }
template <class RightValueType>

View File

@ -143,7 +143,7 @@ public:
advance(firstnew,oldsize);
_updateOVP(firstnew,(*this).end());
}
if (QualityEnabled) QV.resize(_size);
if (QualityEnabled) QV.resize(_size,0);
if (_ColorEnabled) CV.resize(_size);
if (MarkEnabled) MV.resize(_size);
if (NormalEnabled) NV.resize(_size);
@ -218,7 +218,7 @@ void ReorderFace(std::vector<size_t> &newFaceIndex )
}
}
if (QualityEnabled) QV.resize(BaseType::size());
if (QualityEnabled) QV.resize(BaseType::size(),0);
if (_ColorEnabled) CV.resize(BaseType::size());
if (MarkEnabled) MV.resize(BaseType::size());
if (NormalEnabled) NV.resize(BaseType::size());
@ -237,7 +237,7 @@ bool IsQualityEnabled() const {return QualityEnabled;}
void EnableQuality() {
assert(VALUE_TYPE::HasQualityOcf());
QualityEnabled=true;
QV.resize((*this).size());
QV.resize((*this).size(),0);
}
void DisableQuality() {

View File

@ -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 {
public:
typedef A QualityType;
Quality():_quality(0) {}
inline const QualityType &Q() const { return _quality; }
inline QualityType &Q() { return _quality; }
inline QualityType cQ() const {return _quality; }

View File

@ -67,6 +67,7 @@ public:
BaseType::push_back(v);
BaseType::back()._ovp = this;
if (ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
if (QualityEnabled) QV.push_back(0);
if (MarkEnabled) MV.push_back(0);
if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
if (TexCoordEnabled) TV.push_back(typename VALUE_TYPE::TexCoordType());
@ -88,6 +89,7 @@ public:
_updateOVP(firstnew,(*this).end());
}
if (ColorEnabled) CV.resize(_size);
if (QualityEnabled) QV.resize(_size,0);
if (MarkEnabled) MV.resize(_size);
if (NormalEnabled) NV.resize(_size);
if (TexCoordEnabled) TV.resize(_size);
@ -101,6 +103,7 @@ public:
{
BaseType::reserve(_size);
if (ColorEnabled) CV.reserve(_size);
if (QualityEnabled) QV.reserve(_size);
if (MarkEnabled) MV.reserve(_size);
if (NormalEnabled) NV.reserve(_size);
if (TexCoordEnabled) TV.reserve(_size);
@ -124,7 +127,7 @@ bool IsQualityEnabled() const {return QualityEnabled;}
void EnableQuality() {
assert(VALUE_TYPE::HasQualityOcf());
QualityEnabled=true;
QV.resize((*this).size());
QV.resize((*this).size(),0);
}
void DisableQuality() {
assert(VALUE_TYPE::HasQualityOcf());