added WedgeNormalOcf and WedgeColorOcf.
This commit is contained in:
parent
86c2311130
commit
35189992a9
|
|
@ -146,6 +146,8 @@ public:
|
||||||
WedgeTexEnabled=false;
|
WedgeTexEnabled=false;
|
||||||
VFAdjacencyEnabled=false;
|
VFAdjacencyEnabled=false;
|
||||||
FFAdjacencyEnabled=false;
|
FFAdjacencyEnabled=false;
|
||||||
|
WedgeColorEnabled=false;
|
||||||
|
WedgeNormalEnabled=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Auxiliary types to build internal vectors
|
// Auxiliary types to build internal vectors
|
||||||
|
|
@ -178,7 +180,36 @@ public:
|
||||||
typename VALUE_TYPE::TexCoordType wt[3];
|
typename VALUE_TYPE::TexCoordType wt[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class WedgeColorTypePack {
|
||||||
|
public:
|
||||||
|
WedgeColorTypePack() {
|
||||||
|
typedef typename VALUE_TYPE::ColorType::ScalarType ScalarType;
|
||||||
|
for (int i=0; i<3; ++i)
|
||||||
|
{
|
||||||
|
wc[i][0] = ScalarType(255);
|
||||||
|
wc[i][1] = ScalarType(255);
|
||||||
|
wc[i][2] = ScalarType(255);
|
||||||
|
wc[i][3] = ScalarType(255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typename VALUE_TYPE::ColorType wc[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
class WedgeNormalTypePack {
|
||||||
|
public:
|
||||||
|
WedgeNormalTypePack() {
|
||||||
|
typedef typename VALUE_TYPE::NormalType::ScalarType ScalarType;
|
||||||
|
for (int i=0; i<3; ++i)
|
||||||
|
{
|
||||||
|
wn[i][0] = ScalarType(0);
|
||||||
|
wn[i][1] = ScalarType(0);
|
||||||
|
wn[i][2] = ScalarType(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typename VALUE_TYPE::NormalType wn[3];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// override di tutte le funzioni che possono spostare
|
// override di tutte le funzioni che possono spostare
|
||||||
|
|
@ -194,6 +225,8 @@ public:
|
||||||
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 (WedgeNormalEnabled) WNV.push_back(WedgeNormalTypePack());
|
||||||
}
|
}
|
||||||
void pop_back();
|
void pop_back();
|
||||||
void resize(const unsigned int & _size)
|
void resize(const unsigned int & _size)
|
||||||
|
|
@ -212,7 +245,8 @@ public:
|
||||||
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 (WedgeNormalEnabled) WNV.resize(_size);
|
||||||
}
|
}
|
||||||
void reserve(const unsigned int & _size)
|
void reserve(const unsigned int & _size)
|
||||||
{
|
{
|
||||||
|
|
@ -226,6 +260,8 @@ public:
|
||||||
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 (WedgeNormalEnabled) WNV.reserve(_size);
|
||||||
|
|
||||||
if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
|
if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
|
||||||
}
|
}
|
||||||
|
|
@ -248,9 +284,11 @@ void ReorderFace(std::vector<size_t> &newFaceIndex )
|
||||||
if (ColorEnabled) assert( CV.size() == newFaceIndex.size() );
|
if (ColorEnabled) assert( CV.size() == newFaceIndex.size() );
|
||||||
if (MarkEnabled) assert( MV.size() == newFaceIndex.size() );
|
if (MarkEnabled) assert( MV.size() == newFaceIndex.size() );
|
||||||
if (NormalEnabled) assert( NV.size() == newFaceIndex.size() );
|
if (NormalEnabled) assert( NV.size() == newFaceIndex.size() );
|
||||||
if (VFAdjacencyEnabled)assert( AV.size() == newFaceIndex.size() );
|
if (VFAdjacencyEnabled) assert( AV.size() == newFaceIndex.size() );
|
||||||
if (FFAdjacencyEnabled)assert( AF.size() == newFaceIndex.size() );
|
if (FFAdjacencyEnabled) assert( AF.size() == newFaceIndex.size() );
|
||||||
if (WedgeTexEnabled) assert(WTV.size() == newFaceIndex.size() );
|
if (WedgeTexEnabled) assert(WTV.size() == newFaceIndex.size() );
|
||||||
|
if (WedgeColorEnabled) assert(WCV.size() == newFaceIndex.size() );
|
||||||
|
if (WedgeNormalEnabled) assert(WNV.size() == newFaceIndex.size() );
|
||||||
|
|
||||||
for(i=0;i<newFaceIndex.size();++i)
|
for(i=0;i<newFaceIndex.size();++i)
|
||||||
{
|
{
|
||||||
|
|
@ -264,6 +302,8 @@ void ReorderFace(std::vector<size_t> &newFaceIndex )
|
||||||
if (VFAdjacencyEnabled) AV[newFaceIndex[i]] = AV[i];
|
if (VFAdjacencyEnabled) AV[newFaceIndex[i]] = AV[i];
|
||||||
if (FFAdjacencyEnabled) AF[newFaceIndex[i]] = AF[i];
|
if (FFAdjacencyEnabled) AF[newFaceIndex[i]] = AF[i];
|
||||||
if (WedgeTexEnabled) WTV[newFaceIndex[i]] = WTV[i];
|
if (WedgeTexEnabled) WTV[newFaceIndex[i]] = WTV[i];
|
||||||
|
if (WedgeColorEnabled) WCV[newFaceIndex[i]] = WCV[i];
|
||||||
|
if (WedgeNormalEnabled) WNV[newFaceIndex[i]] = WNV[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -274,6 +314,8 @@ void ReorderFace(std::vector<size_t> &newFaceIndex )
|
||||||
if (VFAdjacencyEnabled) AV.resize(BaseType::size());
|
if (VFAdjacencyEnabled) AV.resize(BaseType::size());
|
||||||
if (FFAdjacencyEnabled) AF.resize(BaseType::size());
|
if (FFAdjacencyEnabled) AF.resize(BaseType::size());
|
||||||
if (WedgeTexEnabled) WTV.resize(BaseType::size());
|
if (WedgeTexEnabled) WTV.resize(BaseType::size());
|
||||||
|
if (WedgeColorEnabled) WCV.resize(BaseType::size());
|
||||||
|
if (WedgeNormalEnabled) WNV.resize(BaseType::size());
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////
|
////////////////////////////////////////
|
||||||
|
|
@ -371,6 +413,32 @@ void DisableWedgeTex() {
|
||||||
WTV.clear();
|
WTV.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsWedgeColorEnabled() const {return WedgeColorEnabled;}
|
||||||
|
void EnableWedgeColor() {
|
||||||
|
assert(VALUE_TYPE::HasWedgeColorOcf());
|
||||||
|
WedgeColorEnabled=true;
|
||||||
|
WCV.resize((*this).size(),WedgeColorTypePack());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisableWedgeColor() {
|
||||||
|
assert(VALUE_TYPE::HasWedgeColorOcf());
|
||||||
|
WedgeColorEnabled=false;
|
||||||
|
WCV.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsWedgeNormalEnabled() const {return WedgeNormalEnabled;}
|
||||||
|
void EnableWedgeNormal() {
|
||||||
|
assert(VALUE_TYPE::HasWedgeNormalOcf());
|
||||||
|
WedgeNormalEnabled=true;
|
||||||
|
WNV.resize((*this).size(),WedgeNormalTypePack());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DisableWedgeNormal() {
|
||||||
|
assert(VALUE_TYPE::HasWedgeNormalOcf());
|
||||||
|
WedgeNormalEnabled=false;
|
||||||
|
WNV.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
std::vector<float> QV;
|
std::vector<float> QV;
|
||||||
std::vector<typename VALUE_TYPE::ColorType> CV;
|
std::vector<typename VALUE_TYPE::ColorType> CV;
|
||||||
|
|
@ -379,6 +447,8 @@ public:
|
||||||
std::vector<struct AdjTypePack> AV;
|
std::vector<struct AdjTypePack> AV;
|
||||||
std::vector<struct AdjTypePack> AF;
|
std::vector<struct AdjTypePack> AF;
|
||||||
std::vector<class WedgeTexTypePack> WTV;
|
std::vector<class WedgeTexTypePack> WTV;
|
||||||
|
std::vector<class WedgeColorTypePack> WCV;
|
||||||
|
std::vector<class WedgeNormalTypePack> WNV;
|
||||||
|
|
||||||
bool QualityEnabled;
|
bool QualityEnabled;
|
||||||
bool ColorEnabled;
|
bool ColorEnabled;
|
||||||
|
|
@ -387,6 +457,8 @@ public:
|
||||||
bool WedgeTexEnabled;
|
bool WedgeTexEnabled;
|
||||||
bool VFAdjacencyEnabled;
|
bool VFAdjacencyEnabled;
|
||||||
bool FFAdjacencyEnabled;
|
bool FFAdjacencyEnabled;
|
||||||
|
bool WedgeColorEnabled;
|
||||||
|
bool WedgeNormalEnabled;
|
||||||
}; // end class vector_ocf
|
}; // end class vector_ocf
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -607,6 +679,50 @@ public:
|
||||||
|
|
||||||
template <class T> class WedgeTexCoordfOcf: public WedgeTexCoordOcf<TexCoord2<float,1>, T> {};
|
template <class T> class WedgeTexCoordfOcf: public WedgeTexCoordOcf<TexCoord2<float,1>, T> {};
|
||||||
|
|
||||||
|
///*-------------------------- WEDGE COLOR ----------------------------------*/
|
||||||
|
|
||||||
|
template <class A, class TT> class WedgeColorOcf: public TT {
|
||||||
|
public:
|
||||||
|
WedgeColorOcf(){ }
|
||||||
|
typedef A ColorType;
|
||||||
|
ColorType &WC(const int i) { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; }
|
||||||
|
const ColorType & cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; }
|
||||||
|
template <class LeftF>
|
||||||
|
void ImportLocal(const LeftF & leftF){
|
||||||
|
//if(this->Base().WedgeColorEnabled && leftF.Base().WedgeColorEnabled) // WRONG I do not know anything about leftV!
|
||||||
|
if(this->Base().WedgeColorEnabled)
|
||||||
|
{ WC(0) = leftF.cWC(0); WC(1) = leftF.cWC(1); WC(2) = leftF.cWC(2); }
|
||||||
|
TT::ImportLocal(leftF);
|
||||||
|
}
|
||||||
|
static bool HasWedgeColor() { return true; }
|
||||||
|
static bool HasWedgeColorOcf() { return true; }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T> class WedgeColor4bOcf: public WedgeColorOcf<vcg::Color4b, T> {};
|
||||||
|
|
||||||
|
///*-------------------------- WEDGE NORMAL ----------------------------------*/
|
||||||
|
|
||||||
|
template <class A, class TT> class WedgeNormalOcf: public TT {
|
||||||
|
public:
|
||||||
|
WedgeNormalOcf(){ }
|
||||||
|
typedef A NormalType;
|
||||||
|
NormalType &WN(const int i) { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; }
|
||||||
|
NormalType const &cWN(const int i) const { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; }
|
||||||
|
template <class LeftF>
|
||||||
|
void ImportLocal(const LeftF & leftF){
|
||||||
|
//if(this->Base().WedgeNormalEnabled && leftF.Base().WedgeNormalEnabled) // WRONG I do not know anything about leftV!
|
||||||
|
if(this->Base().WedgeNormalEnabled)
|
||||||
|
{ WN(0) = leftF.cWN(0); WN(1) = leftF.cWN(1); WN(2) = leftF.cWN(2); }
|
||||||
|
TT::ImportLocal(leftF);
|
||||||
|
}
|
||||||
|
static bool HasWedgeNormal() { return true; }
|
||||||
|
static bool HasWedgeNormalOcf() { return true; }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T> class WedgeNormal3sOcf: public WedgeNormalOcf<vcg::Point3s, T> {};
|
||||||
|
template <class T> class WedgeNormal3fOcf: public WedgeNormalOcf<vcg::Point3f, T> {};
|
||||||
|
template <class T> class WedgeNormal3dOcf: public WedgeNormalOcf<vcg::Point3d, T> {};
|
||||||
|
|
||||||
///*-------------------------- InfoOpt ----------------------------------*/
|
///*-------------------------- InfoOpt ----------------------------------*/
|
||||||
|
|
||||||
template < class T> class InfoOcf: public T {
|
template < class T> class InfoOcf: public T {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue