Significant rewrote of the ImportLocal framework. Now it can really manage differently typed meshes.
It still requires that for OCF meshes the user enable stuff as needed.
This commit is contained in:
parent
3745e4db1f
commit
8be6f002a3
|
@ -415,7 +415,8 @@ public:
|
||||||
|
|
||||||
template <class LeftF>
|
template <class LeftF>
|
||||||
void ImportLocal(const LeftF & leftF){
|
void ImportLocal(const LeftF & leftF){
|
||||||
if(leftF.Base().VFAdjacencyEnabled && this->Base().VFAdjacencyEnabled){
|
//if(leftF.Base().VFAdjacencyEnabled && this->Base().VFAdjacencyEnabled)// WRONG I do not know anything about leftV!
|
||||||
|
if(this->Base().VFAdjacencyEnabled){
|
||||||
VFp(0) = NULL; VFp(1) = NULL; VFp(2) = NULL;
|
VFp(0) = NULL; VFp(1) = NULL; VFp(2) = NULL;
|
||||||
VFi(0) = -1; VFi(1) = -1; VFi(2) = -1;
|
VFi(0) = -1; VFi(1) = -1; VFi(2) = -1;
|
||||||
}
|
}
|
||||||
|
@ -458,7 +459,8 @@ public:
|
||||||
|
|
||||||
template <class LeftF>
|
template <class LeftF>
|
||||||
void ImportLocal(const LeftF & leftF){
|
void ImportLocal(const LeftF & leftF){
|
||||||
if(leftF.Base().FFAdjacencyEnabled && this->Base().FFAdjacencyEnabled) {
|
// if(leftF.Base().FFAdjacencyEnabled && this->Base().FFAdjacencyEnabled) // WRONG I do not know anything about leftV!
|
||||||
|
if(this->Base().FFAdjacencyEnabled) {
|
||||||
FFp(0) = NULL; FFp(1) = NULL; FFp(2) = NULL;
|
FFp(0) = NULL; FFp(1) = NULL; FFp(2) = NULL;
|
||||||
FFi(0) = -1; FFi(1) = -1; FFi(2) = -1;
|
FFi(0) = -1; FFi(1) = -1; FFi(2) = -1;
|
||||||
}
|
}
|
||||||
|
@ -516,8 +518,9 @@ public:
|
||||||
|
|
||||||
template <class LeftF>
|
template <class LeftF>
|
||||||
void ImportLocal(const LeftF & leftF){
|
void ImportLocal(const LeftF & leftF){
|
||||||
if((*this).Base().QualityEnabled && leftF.Base().QualityEnabled)
|
//if((*this).Base().QualityEnabled && leftF.Base().QualityEnabled)// WRONG I do not know anything about leftV!
|
||||||
Q() = leftF.Q();
|
if((*this).Base().QualityEnabled)
|
||||||
|
Q() = leftF.cQ();
|
||||||
T::ImportLocal(leftF);
|
T::ImportLocal(leftF);
|
||||||
}
|
}
|
||||||
static bool HasFaceQuality() { return true; }
|
static bool HasFaceQuality() { return true; }
|
||||||
|
@ -542,8 +545,9 @@ public:
|
||||||
|
|
||||||
template <class LeftF>
|
template <class LeftF>
|
||||||
void ImportLocal(const LeftF & leftF){
|
void ImportLocal(const LeftF & leftF){
|
||||||
if((*this).Base().ColorEnabled && leftF.Base().ColorEnabled)
|
//if((*this).Base().ColorEnabled && leftF.Base().ColorEnabled)// WRONG I do not know anything about leftV!
|
||||||
C() = leftF.C();
|
if((*this).Base().ColorEnabled )
|
||||||
|
C() = leftF.cC();
|
||||||
T::ImportLocal(leftF);
|
T::ImportLocal(leftF);
|
||||||
}
|
}
|
||||||
static bool HasFaceColor() { return true; }
|
static bool HasFaceColor() { return true; }
|
||||||
|
@ -568,7 +572,8 @@ public:
|
||||||
|
|
||||||
template <class LeftF>
|
template <class LeftF>
|
||||||
void ImportLocal(const LeftF & leftF){
|
void ImportLocal(const LeftF & leftF){
|
||||||
if((*this).Base().MarkEnabled && leftF.Base().MarkEnabled)
|
//if((*this).Base().MarkEnabled && leftF.Base().MarkEnabled)// WRONG I do not know anything about leftV!
|
||||||
|
if((*this).Base().MarkEnabled)
|
||||||
IMark() = leftF.IMark();
|
IMark() = leftF.IMark();
|
||||||
T::ImportLocal(leftF);
|
T::ImportLocal(leftF);
|
||||||
}
|
}
|
||||||
|
@ -587,7 +592,8 @@ public:
|
||||||
TexCoordType const &cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
|
TexCoordType const &cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
|
||||||
template <class LeftF>
|
template <class LeftF>
|
||||||
void ImportLocal(const LeftF & leftF){
|
void ImportLocal(const LeftF & leftF){
|
||||||
if(this->Base().WedgeTexEnabled && leftF.Base().WedgeTexEnabled)
|
//if(this->Base().WedgeTexEnabled && leftF.Base().WedgeTexEnabled) // WRONG I do not know anything about leftV!
|
||||||
|
if(this->Base().WedgeTexEnabled)
|
||||||
{ WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); }
|
{ WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); }
|
||||||
TT::ImportLocal(leftF);
|
TT::ImportLocal(leftF);
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ template <class BVT, class BET=DumClass, class BFT=DumClass, class BTT=DumClass>
|
||||||
class VertexBase: public vertex::EmptyTexCoord<
|
class VertexBase: public vertex::EmptyTexCoord<
|
||||||
vertex::EmptyVFAdj<
|
vertex::EmptyVFAdj<
|
||||||
vertex::EmptyVEAdj<
|
vertex::EmptyVEAdj<
|
||||||
vertex::EmptyColorQuality<
|
vertex::EmptyColorMarkQuality<
|
||||||
vertex::EmptyBitFlags<
|
vertex::EmptyBitFlags<
|
||||||
vertex::EmptyCoordNormal<
|
vertex::EmptyCoordNormal<
|
||||||
vertex::EmptyCurvatureData<
|
vertex::EmptyCurvatureData<
|
||||||
|
|
|
@ -163,7 +163,7 @@ public:
|
||||||
CoordType &UberP() { return _coord; }
|
CoordType &UberP() { return _coord; }
|
||||||
|
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { P().Import(left.cP()); T::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { if(LeftV::HasCoord()) P().Import(left.cP()); T::ImportLocal( left); }
|
||||||
static bool HasCoord() { return true; }
|
static bool HasCoord() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord"));T::Name(name);}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ public:
|
||||||
NormalType &N() { return _norm; }
|
NormalType &N() { return _norm; }
|
||||||
const NormalType &cN() const { return _norm; }
|
const NormalType &cN() const { return _norm; }
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { N() = left.cN(); T::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { if(LeftV::HasNormal()) N() = left.cN(); T::ImportLocal( left); }
|
||||||
static bool HasNormal() { return true; }
|
static bool HasNormal() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal"));T::Name(name);}
|
||||||
|
|
||||||
|
@ -206,27 +206,16 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
|
||||||
|
|
||||||
/*-------------------------- INCREMENTAL MARK ----------------------------------------*/
|
/*-------------------------- INCREMENTAL MARK ----------------------------------------*/
|
||||||
|
|
||||||
template <class T> class EmptyMark: public T {
|
|
||||||
public:
|
|
||||||
static bool HasMark() { return false; }
|
|
||||||
static bool HasMarkOcc() { return false; }
|
|
||||||
inline void InitIMark() { }
|
|
||||||
inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
|
|
||||||
inline const int & IMark() const {return 0;}
|
|
||||||
template < class LeftV>
|
|
||||||
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
|
|
||||||
static void Name(std::vector<std::string> & name){T::Name(name);}
|
|
||||||
|
|
||||||
};
|
|
||||||
template <class T> class Mark: public T {
|
template <class T> class Mark: public T {
|
||||||
public:
|
public:
|
||||||
static bool HasMark() { return true; }
|
static bool HasMark() { return true; }
|
||||||
static bool HasMarkOcc() { return true; }
|
static bool HasMarkOcc() { return true; }
|
||||||
inline void InitIMark() { _imark = 0; }
|
inline void InitIMark() { _imark = 0; }
|
||||||
|
inline const int & cIMark() const { return _imark;}
|
||||||
inline int & IMark() { return _imark;}
|
inline int & IMark() { return _imark;}
|
||||||
inline const int & IMark() const {return _imark;}
|
inline const int & IMark() const {return _imark;}
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { IMark() = left.IMark(); T::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { if(LeftV::HasMark()) IMark() = left.IMark(); T::ImportLocal( left); }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -251,7 +240,7 @@ public:
|
||||||
TexCoordType &T() { return _t; }
|
TexCoordType &T() { return _t; }
|
||||||
const TexCoordType &cT() const { return _t; }
|
const TexCoordType &cT() const { return _t; }
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { T() = left.cT(); TT::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { if(LeftV::HasTexCoord()) T() = left.cT(); TT::ImportLocal( left); }
|
||||||
static bool HasTexCoord() { return true; }
|
static bool HasTexCoord() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);}
|
||||||
|
|
||||||
|
@ -291,7 +280,7 @@ public:
|
||||||
int &Flags() {return _flags; }
|
int &Flags() {return _flags; }
|
||||||
const int Flags() const {return _flags; }
|
const int Flags() const {return _flags; }
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { Flags() = left.Flags(); T::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { if(LeftV::HasFlags()) Flags() = left.Flags(); T::ImportLocal( left); }
|
||||||
static bool HasFlags() { return true; }
|
static bool HasFlags() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
|
||||||
|
|
||||||
|
@ -301,16 +290,24 @@ private:
|
||||||
|
|
||||||
/*-------------------------- EMPTY COLOR & QUALITY ----------------------------------*/
|
/*-------------------------- EMPTY COLOR & QUALITY ----------------------------------*/
|
||||||
|
|
||||||
template <class T> class EmptyColorQuality: public T {
|
template <class T> class EmptyColorMarkQuality: public T {
|
||||||
public:
|
public:
|
||||||
typedef float QualityType;
|
typedef float QualityType;
|
||||||
QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
|
QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
|
||||||
|
const QualityType &cQ() const { static QualityType dummyQuality(0); assert(0); return dummyQuality; } const
|
||||||
static bool HasQuality() { return false; }
|
static bool HasQuality() { return false; }
|
||||||
|
|
||||||
typedef vcg::Color4b ColorType;
|
typedef vcg::Color4b ColorType;
|
||||||
ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
|
ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
|
||||||
const ColorType &cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
|
const ColorType &cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
|
||||||
|
|
||||||
|
static bool HasMark() { return false; }
|
||||||
|
static bool HasMarkOcc() { return false; }
|
||||||
|
inline void InitIMark() { }
|
||||||
|
inline const int & cIMark() const { assert(0); static int tmp=-1; return tmp;}
|
||||||
|
inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
|
||||||
|
inline const int & IMark() const {return 0;}
|
||||||
|
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); }
|
||||||
static bool HasColor() { return false; }
|
static bool HasColor() { return false; }
|
||||||
|
@ -327,7 +324,7 @@ public:
|
||||||
const ColorType &C() const { return _color; }
|
const ColorType &C() const { return _color; }
|
||||||
const ColorType &cC() const { return _color; }
|
const ColorType &cC() const { return _color; }
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { C() = left.cC(); T::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { if(LeftV::HasColor()) C() = left.cC(); T::ImportLocal( left); }
|
||||||
static bool HasColor() { return true; }
|
static bool HasColor() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
|
||||||
|
|
||||||
|
@ -347,7 +344,7 @@ public:
|
||||||
QualityType &Q() { return _quality; }
|
QualityType &Q() { return _quality; }
|
||||||
const QualityType & cQ() const {return _quality; }
|
const QualityType & cQ() const {return _quality; }
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { Q() = left.cQ(); TT::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { if(LeftV::HasQuality()) Q() = left.cQ(); TT::ImportLocal( left); }
|
||||||
static bool HasQuality() { return true; }
|
static bool HasQuality() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
|
||||||
|
|
||||||
|
@ -518,7 +515,7 @@ public:
|
||||||
RadiusType &R() { return _radius; }
|
RadiusType &R() { return _radius; }
|
||||||
const RadiusType & cR() const {return _radius; }
|
const RadiusType & cR() const {return _radius; }
|
||||||
template < class LeftV>
|
template < class LeftV>
|
||||||
void ImportLocal(const LeftV & left ) { R() = left.cR(); TT::ImportLocal( left); }
|
void ImportLocal(const LeftV & left ) { if(LeftV::HasRadius()) R() = left.cR(); TT::ImportLocal( left); }
|
||||||
static bool HasRadius() { return true; }
|
static bool HasRadius() { return true; }
|
||||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Radius"));TT::Name(name);}
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("Radius"));TT::Name(name);}
|
||||||
|
|
||||||
|
|
|
@ -466,7 +466,8 @@ public:
|
||||||
template <class LeftV>
|
template <class LeftV>
|
||||||
void ImportLocal(const LeftV & leftV)
|
void ImportLocal(const LeftV & leftV)
|
||||||
{
|
{
|
||||||
if((*this).Base().MarkEnabled && leftV.Base().MarkEnabled ) // copy the data only if they are enabled in both vertices
|
//if((*this).Base().MarkEnabled && leftV.Base().MarkEnabled ) // WRONG I do not know anything about leftV!
|
||||||
|
if((*this).Base().MarkEnabled) // copy the data only if they are enabled in both vertices
|
||||||
IMark() = leftV.IMark();
|
IMark() = leftV.IMark();
|
||||||
T::ImportLocal(leftV);
|
T::ImportLocal(leftV);
|
||||||
}
|
}
|
||||||
|
@ -490,7 +491,8 @@ public:
|
||||||
|
|
||||||
template <class LeftV>
|
template <class LeftV>
|
||||||
void ImportLocal(const LeftV & leftV){
|
void ImportLocal(const LeftV & leftV){
|
||||||
if((*this).Base().CurvatureEnabled && leftV.Base().CurvatureEnabled ) // copy the data only if they are enabled in both vertices
|
// if((*this).Base().CurvatureEnabled && leftV.Base().CurvatureEnabled ) // WRONG I do not know anything about leftV!
|
||||||
|
if((*this).Base().CurvatureEnabled)
|
||||||
{
|
{
|
||||||
(*this).Base().CuV[(*this).Index()][0] = leftV.cKh();
|
(*this).Base().CuV[(*this).Index()][0] = leftV.cKh();
|
||||||
(*this).Base().CuV[(*this).Index()][1] = leftV.cKg();
|
(*this).Base().CuV[(*this).Index()][1] = leftV.cKg();
|
||||||
|
@ -564,7 +566,8 @@ public:
|
||||||
template <class LeftV>
|
template <class LeftV>
|
||||||
void ImportLocal(const LeftV & leftV)
|
void ImportLocal(const LeftV & leftV)
|
||||||
{
|
{
|
||||||
if ((*this).Base().RadiusEnabled && leftV.Base().RadiusEnabled )
|
//if ((*this).Base().RadiusEnabled && leftV.Base().RadiusEnabled ) // WRONG I do not know anything about leftV!
|
||||||
|
if ((*this).Base().RadiusEnabled)
|
||||||
(*this).Base().RadiusV[(*this).Index()] = leftV.cR();
|
(*this).Base().RadiusV[(*this).Index()] = leftV.cR();
|
||||||
TT::ImportLocal(leftV);
|
TT::ImportLocal(leftV);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue