Reorganized ocf face component and added a standard interface for query the availabiilty of data:

now we have 
static bool FaceType::HasXXX() // statically says if a certain type is present
bool FaceType::IsXXXAvaialble() // NON STATIC (always true for non ocf objects)
So now ImportData works for face ocf component.
This commit is contained in:
Paolo Cignoni 2012-12-17 15:02:34 +00:00
parent 4d0450d521
commit 08aeee8716
2 changed files with 116 additions and 92 deletions

View File

@ -52,15 +52,12 @@ public:
NormalType &WN(int) { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; } NormalType &WN(int) { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
NormalType cWN(int) const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; } NormalType cWN(int) const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; }
static bool HasNormal() { return false; }
static bool HasWedgeNormal() { return false; }
typedef int WedgeTexCoordType; typedef int WedgeTexCoordType;
typedef vcg::TexCoord2<float,1> TexCoordType; typedef vcg::TexCoord2<float,1> TexCoordType;
TexCoordType &WT(const int) { static TexCoordType dummy_texture; assert(0); return dummy_texture;} TexCoordType &WT(const int) { static TexCoordType dummy_texture; assert(0); return dummy_texture;}
TexCoordType const &cWT(const int) const { static TexCoordType dummy_texture; return dummy_texture;} TexCoordType const &cWT(const int) const { static TexCoordType dummy_texture; return dummy_texture;}
static bool HasWedgeTexCoord() { return false; }
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; } int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
int cFlags() const { return 0; } int cFlags() const { return 0; }
@ -85,10 +82,25 @@ public:
Quality3Type cQ3() const { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; } Quality3Type cQ3() const { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; }
static bool HasColor() { return false; } static bool HasColor() { return false; }
static bool HasWedgeColor() { return false; }
static bool HasQuality() { return false; } static bool HasQuality() { return false; }
static bool HasQuality3() { return false; } static bool HasQuality3() { return false; }
static bool HasMark() { return false; } static bool HasMark() { return false; }
static bool HasNormal() { return false; }
static bool HasWedgeColor() { return false; }
static bool HasWedgeNormal() { return false; }
static bool HasWedgeTexCoord() { return false; }
// Interfaces for dynamic types
inline bool IsColorEnabled( ) const { return T::FaceType::HasColor(); }
inline bool IsQualityEnabled( ) const { return T::FaceType::HasQuality(); }
inline bool IsQuality3Enabled( ) const { return T::FaceType::HasQuality3(); }
inline bool IsMarkEnabled( ) const { return T::FaceType::HasMark(); }
inline bool IsNormalEnabled( ) const { return T::FaceType::HasNormal(); }
inline bool IsWedgeColorEnabled( ) const { return T::FaceType::HasWedgeColor(); }
inline bool IsWedgeNormalEnabled( ) const { return T::FaceType::HasWedgeNormal(); }
inline bool IsWedgeTexCoordEnabled( ) const { return T::FaceType::HasWedgeTexCoord(); }
typedef int VFAdjType; typedef int VFAdjType;
typename T::FacePointer &VFp(int) { static typename T::FacePointer fp=0; assert(0); return fp; } typename T::FacePointer &VFp(int) { static typename T::FacePointer fp=0; assert(0); return fp; }
@ -127,7 +139,7 @@ public:
static bool HasPolyInfo() { return false; } static bool HasPolyInfo() { return false; }
template <class RightValueType> template <class RightValueType>
void ImportData(const RightValueType & rightF) {T::ImportData(rightF);} void ImportData(const RightValueType & rightF) {T::ImportData(rightF);}
inline void Alloc(const int & ns) {T::Alloc(ns);} inline void Alloc(const int & ns) {T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
@ -203,8 +215,8 @@ public:
template <class RightValueType> template <class RightValueType>
void ImportData(const RightValueType & rightF) void ImportData(const RightValueType & rightF)
{ {
if(RightValueType::HasNormal()) N().Import(rightF.cN()); if(rightF.IsNormalEnabled()) N().Import(rightF.cN());
T::ImportData( rightF); T::ImportData(rightF);
} }
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
@ -222,7 +234,7 @@ public:
inline NormalType &WN(int j) { return _wnorm[j]; } inline NormalType &WN(int j) { return _wnorm[j]; }
inline NormalType cWN(int j) const { return _wnorm[j]; } inline NormalType cWN(int j) const { return _wnorm[j]; }
template <class RightValueType> template <class RightValueType>
void ImportData(const RightValueType & rightF){ if(RightValueType::HasWedgeNormal()) for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportData(rightF);} void ImportData(const RightValueType & rightF){ if(rightF.IsWedgeNormalEnabled()) for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasWedgeNormal() { return true; } static bool HasWedgeNormal() { return true; }
@ -276,7 +288,7 @@ public:
TexCoordType cWT(const int i) const { return _wt[i]; } TexCoordType cWT(const int i) const { return _wt[i]; }
template <class RightValueType> template <class RightValueType>
void ImportData(const RightValueType & rightF){ void ImportData(const RightValueType & rightF){
if(RightValueType::HasWedgeTexCoord()) if(rightF.IsWedgeTexCoordEnabled())
for (int i=0; i<3; ++i) { WT(i) = rightF.cWT(i); } for (int i=0; i<3; ++i) { WT(i) = rightF.cWT(i); }
T::ImportData(rightF); T::ImportData(rightF);
} }
@ -333,8 +345,7 @@ public:
ColorType cC() const { return _color; } ColorType cC() const { return _color; }
template <class RightValueType> template <class RightValueType>
void ImportData(const RightValueType & rightF){ void ImportData(const RightValueType & rightF){
if(RightValueType::HasColor()) if(rightF.IsColorEnabled()) C() = rightF.cC();
C() = rightF.cC();
T::ImportData(rightF); T::ImportData(rightF);
} }
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
@ -354,7 +365,7 @@ public:
template <class RightValueType> template <class RightValueType>
void ImportData(const RightValueType & rightF){ void ImportData(const RightValueType & rightF){
if (RightValueType::HasWedgeColor()) if (rightF.IsWedgeColorEnabled())
{ {
for (int i=0; i<3; ++i) { WC(i) = rightF.cWC(i); } for (int i=0; i<3; ++i) { WC(i) = rightF.cWC(i); }
} }
@ -386,7 +397,7 @@ public:
QualityType cQ() const { return _quality; } QualityType cQ() const { return _quality; }
template <class RightValueType> template <class RightValueType>
void ImportData(const RightValueType & rightF){ void ImportData(const RightValueType & rightF){
if(RightValueType::HasQuality()) if(rightF.IsQualityEnabled())
Q() = rightF.cQ(); Q() = rightF.cQ();
T::ImportData(rightF); T::ImportData(rightF);
} }
@ -416,7 +427,7 @@ public:
Quality3Type cQ3() const { return _quality; } Quality3Type cQ3() const { return _quality; }
template <class RightValueType> template <class RightValueType>
void ImportData(const RightValueType & rightF){ void ImportData(const RightValueType & rightF){
if(RightValueType::HasQuality3()) Q3() = rightF.cQ3(); if(rightF.IsQuality3Enabled()) Q3() = rightF.cQ3();
T::ImportData(rightF); T::ImportData(rightF);
} }
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
@ -451,7 +462,7 @@ public:
static bool HasMark() { return true; } static bool HasMark() { return true; }
template <class RightValueType> template <class RightValueType>
void ImportData(const RightValueType & rightF){ void ImportData(const RightValueType & rightF){
if(RightValueType::HasMark()) if(rightF.IsMarkEnabled())
IMark() = rightF.cIMark(); IMark() = rightF.cIMark();
T::ImportData(rightF); T::ImportData(rightF);
} }
@ -487,12 +498,12 @@ public:
ScalarType cK1() const {return _curv.k1;} ScalarType cK1() const {return _curv.k1;}
ScalarType cK2() const {return _curv.k2;} ScalarType cK2() const {return _curv.k2;}
template < class RightValueType> template < class RightValueType>
void ImportData(const RightValueType & left ) { void ImportData(const RightValueType & rightF ) {
if(RightValueType::HasCurvatureDir()) { if(rightF.IsCurvatureDirEnabled()) {
PD1() = left.cPD1(); PD2() = left.cPD2(); PD1() = rightF.cPD1(); PD2() = rightF.cPD2();
K1() = left.cK1(); K2() = left.cK2(); K1() = rightF.cK1(); K2() = rightF.cK2();
} }
TT::ImportData( left); TT::ImportData(rightF);
} }
static bool HasCurvatureDir() { return true; } static bool HasCurvatureDir() { return true; }

View File

@ -41,7 +41,7 @@ class vector_ocf: public std::vector<VALUE_TYPE> {
public: public:
vector_ocf():std::vector<VALUE_TYPE>() vector_ocf():std::vector<VALUE_TYPE>()
{ {
ColorEnabled=false; _ColorEnabled=false;
CurvatureDirEnabled = false; CurvatureDirEnabled = false;
MarkEnabled=false; MarkEnabled=false;
NormalEnabled=false; NormalEnabled=false;
@ -123,7 +123,7 @@ public:
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());
@ -144,7 +144,7 @@ public:
_updateOVP(firstnew,(*this).end()); _updateOVP(firstnew,(*this).end());
} }
if (QualityEnabled) QV.resize(_size); if (QualityEnabled) QV.resize(_size);
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);
@ -159,7 +159,7 @@ public:
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);
@ -190,7 +190,7 @@ void ReorderFace(std::vector<size_t> &newFaceIndex )
{ {
size_t i=0; size_t i=0;
if (QualityEnabled) assert( QV.size() == newFaceIndex.size() ); if (QualityEnabled) assert( QV.size() == newFaceIndex.size() );
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 (CurvatureDirEnabled)assert(CDV.size() == newFaceIndex.size() ); if (CurvatureDirEnabled)assert(CDV.size() == newFaceIndex.size() );
@ -206,7 +206,7 @@ void ReorderFace(std::vector<size_t> &newFaceIndex )
{ {
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];
if (CurvatureDirEnabled) CDV[newFaceIndex[i]] = CDV[i]; if (CurvatureDirEnabled) CDV[newFaceIndex[i]] = CDV[i];
@ -219,7 +219,7 @@ void ReorderFace(std::vector<size_t> &newFaceIndex )
} }
if (QualityEnabled) QV.resize(BaseType::size()); if (QualityEnabled) QV.resize(BaseType::size());
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());
@ -246,16 +246,16 @@ void DisableQuality() {
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());
ColorEnabled=true; _ColorEnabled=true;
CV.resize((*this).size()); CV.resize((*this).size());
} }
void DisableColor() { void DisableColor() {
assert(VALUE_TYPE::HasColorOcf()); assert(VALUE_TYPE::HasColorOcf());
ColorEnabled=false; _ColorEnabled=false;
CV.clear(); CV.clear();
} }
@ -326,14 +326,14 @@ void DisableFFAdjacency() {
AF.clear(); AF.clear();
} }
bool IsWedgeTexEnabled() const {return WedgeTexEnabled;} bool IsWedgeTexCoordEnabled() const {return WedgeTexEnabled;}
void EnableWedgeTex() { void EnableWedgeTexCoord() {
assert(VALUE_TYPE::HasWedgeTexCoordOcf()); assert(VALUE_TYPE::HasWedgeTexCoordOcf());
WedgeTexEnabled=true; WedgeTexEnabled=true;
WTV.resize((*this).size(),WedgeTexTypePack()); WTV.resize((*this).size(),WedgeTexTypePack());
} }
void DisableWedgeTex() { void DisableWedgeTexCoord() {
assert(VALUE_TYPE::HasWedgeTexCoordOcf()); assert(VALUE_TYPE::HasWedgeTexCoordOcf());
WedgeTexEnabled=false; WedgeTexEnabled=false;
WTV.clear(); WTV.clear();
@ -377,7 +377,7 @@ public:
std::vector<struct AdjTypePack> AV; std::vector<struct AdjTypePack> AV;
std::vector<struct AdjTypePack> AF; std::vector<struct AdjTypePack> AF;
bool ColorEnabled; bool _ColorEnabled;
bool CurvatureDirEnabled; bool CurvatureDirEnabled;
bool MarkEnabled; bool MarkEnabled;
bool NormalEnabled; bool NormalEnabled;
@ -408,9 +408,9 @@ public:
return (*this).Base().AV[(*this).Index()]._zp[j]; return (*this).Base().AV[(*this).Index()]._zp[j];
} }
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){ void ImportData(const RightFaceType & rightF){
T::ImportData(leftF); T::ImportData(rightF);
} }
static bool HasVFAdjacency() { return true; } static bool HasVFAdjacency() { return true; }
static bool HasVFAdjacencyOcf() { return true; } static bool HasVFAdjacencyOcf() { return true; }
@ -449,9 +449,9 @@ public:
typename T::FacePointer cNeigh( const int j ) const { return cFFp(j);} typename T::FacePointer cNeigh( const int j ) const { return cFFp(j);}
unsigned int SizeNeigh(){return 3;} unsigned int SizeNeigh(){return 3;}
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){ void ImportData(const RightFaceType & rightF){
T::ImportData(leftF); T::ImportData(rightF);
} }
static bool HasFFAdjacency() { return true; } static bool HasFFAdjacency() { return true; }
static bool HasFFAdjacencyOcf() { return true; } static bool HasFFAdjacencyOcf() { return true; }
@ -473,11 +473,11 @@ public:
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().NV[(*this).Index()]; } return (*this).Base().NV[(*this).Index()]; }
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){ void ImportData(const RightFaceType & rightF){
if((*this).Base().NormalEnabled && LeftF::HasNormal()) if((*this).IsNormalEnabled() && rightF.IsNormalEnabled())
N() = leftF.cN(); N() = rightF.cN();
T::ImportData(leftF); T::ImportData(rightF);
} }
}; };
@ -546,14 +546,14 @@ public:
} }
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){ void ImportData(const RightFaceType & rightF){
if((*this).Base().CurvatureDirEnabled && LeftF::HasCurvatureDir()) if((*this).IsCurvatureDirEnabled() && rightF.IsCurvatureDirEnabled())
PD1() = leftF.cPD1(); PD1() = rightF.cPD1();
PD2() = leftF.cPD2(); PD2() = rightF.cPD2();
K1() = leftF.cK1(); K1() = rightF.cK1();
K2() = leftF.cK2(); K2() = rightF.cK2();
T::ImportData(leftF); T::ImportData(rightF);
} }
}; };
@ -578,11 +578,11 @@ public:
return (*this).Base().QV[(*this).Index()]; return (*this).Base().QV[(*this).Index()];
} }
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){ void ImportData(const RightFaceType & rightF){
if((*this).Base().QualityEnabled && LeftF::HasQuality()) if((*this).IsQualityEnabled() && rightF.IsQualityEnabled())
Q() = leftF.cQ(); Q() = rightF.cQ();
T::ImportData(leftF); T::ImportData(rightF);
} }
static bool HasQuality() { return true; } static bool HasQuality() { return true; }
static bool HasQualityOcf() { return true; } static bool HasQualityOcf() { return true; }
@ -595,19 +595,19 @@ template <class A, class T> class ColorOcf: public T {
public: public:
typedef A ColorType; typedef A ColorType;
ColorType &C() { ColorType &C() {
assert((*this).Base().ColorEnabled); assert((*this).Base()._ColorEnabled);
return (*this).Base().CV[(*this).Index()]; return (*this).Base().CV[(*this).Index()];
} }
ColorType cC() const { ColorType cC() const {
assert((*this).Base().ColorEnabled); assert((*this).Base()._ColorEnabled);
return (*this).Base().CV[(*this).Index()]; return (*this).Base().CV[(*this).Index()];
} }
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){ void ImportData(const RightFaceType & rightF){
if((*this).Base().ColorEnabled && LeftF::HasColor()) if((*this).IsColorEnabled() && rightF.IsColorEnabled())
C() = leftF.cC(); C() = rightF.cC();
T::ImportData(leftF); T::ImportData(rightF);
} }
static bool HasColor() { return true; } static bool HasColor() { return true; }
static bool HasColorOcf() { return true; } static bool HasColorOcf() { return true; }
@ -625,13 +625,13 @@ public:
inline int cIMark() const { inline int cIMark() const {
assert((*this).Base().MarkEnabled); assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()]; return (*this).Base().MV[(*this).Index()];
} ; }
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){ void ImportData(const RightFaceType & rightF){
if((*this).Base().MarkEnabled && LeftF::HasMark()) if((*this).IsMarkEnabled() && rightF.IsMarkEnabled())
IMark() = leftF.cIMark(); IMark() = rightF.cIMark();
T::ImportData(leftF); T::ImportData(rightF);
} }
static bool HasMark() { return true; } static bool HasMark() { return true; }
static bool HasMarkOcf() { return true; } static bool HasMarkOcf() { return true; }
@ -645,12 +645,11 @@ public:
typedef A TexCoordType; typedef A TexCoordType;
TexCoordType &WT(const int i) { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; } TexCoordType &WT(const int i) { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
TexCoordType cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; } TexCoordType cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){ void ImportData(const RightFaceType & rightF){
//if(this->Base().WedgeTexEnabled && leftF.Base().WedgeTexEnabled) // WRONG I do not know anything about leftV! if(this->IsWedgeTexCoordEnabled() && rightF.IsWedgeTexCoordEnabled())
if(this->Base().WedgeTexEnabled && LeftF::HasWedgeTexCoord()) { WT(0) = rightF.cWT(0); WT(1) = rightF.cWT(1); WT(2) = rightF.cWT(2); }
{ WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); } TT::ImportData(rightF);
TT::ImportData(leftF);
} }
static bool HasWedgeTexCoord() { return true; } static bool HasWedgeTexCoord() { return true; }
static bool HasWedgeTexCoordOcf() { return true; } static bool HasWedgeTexCoordOcf() { return true; }
@ -665,11 +664,11 @@ public:
typedef A ColorType; typedef A ColorType;
ColorType &WC(const int i) { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } 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]; } const ColorType cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; }
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){ void ImportData(const RightFaceType & rightF){
if(this->Base().WedgeColorEnabled && LeftF::HasWedgeColor()) if(this->IsWedgeColorEnabled() && rightF.IsWedgeColorEnabled())
{ WC(0) = leftF.cWC(0); WC(1) = leftF.cWC(1); WC(2) = leftF.cWC(2); } { WC(0) = rightF.cWC(0); WC(1) = rightF.cWC(1); WC(2) = rightF.cWC(2); }
TT::ImportData(leftF); TT::ImportData(rightF);
} }
static bool HasWedgeColor() { return true; } static bool HasWedgeColor() { return true; }
static bool HasWedgeColorOcf() { return true; } static bool HasWedgeColorOcf() { return true; }
@ -684,11 +683,11 @@ public:
typedef A NormalType; typedef A NormalType;
NormalType &WN(const int i) { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; } 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]; } NormalType const &cWN(const int i) const { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; }
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){ void ImportData(const RightFaceType & rightF){
if(this->Base().WedgeNormalEnabled && LeftF::HasWedgeNormal()) if(this->IsWedgeNormalEnabled() && rightF.IsWedgeNormalEnabled())
{ WN(0) = leftF.cWN(0); WN(1) = leftF.cWN(1); WN(2) = leftF.cWN(2); } { WN(0) = rightF.cWN(0); WN(1) = rightF.cWN(1); WN(2) = rightF.cWN(2); }
TT::ImportData(leftF); TT::ImportData(rightF);
} }
static bool HasWedgeNormal() { return true; } static bool HasWedgeNormal() { return true; }
static bool HasWedgeNormalOcf() { return true; } static bool HasWedgeNormalOcf() { return true; }
@ -710,20 +709,34 @@ public:
vector_ocf<typename T::FaceType> &Base() const { return *_ovp;} vector_ocf<typename T::FaceType> &Base() const { return *_ovp;}
template <class LeftF> template <class RightFaceType>
void ImportData(const LeftF & leftF){T::ImportData(leftF);} void ImportData(const RightFaceType & rightF){T::ImportData(rightF);}
static bool HasColorOcf() { return false; } static bool HasColorOcf() { return false; }
static bool HasQualityOcf() { return false; }
static bool HasNormalOcf() { return false; }
static bool HasCurvatureDirOcf() { return false; } static bool HasCurvatureDirOcf() { return false; }
static bool HasMarkOcf() { return false; } static bool HasMarkOcf() { return false; }
static bool HasNormalOcf() { return false; }
static bool HasQualityOcf() { return false; }
static bool HasWedgeTexCoordOcf() { return false; } static bool HasWedgeTexCoordOcf() { return false; }
static bool HasWedgeColorOcf() { return false; } static bool HasWedgeColorOcf() { return false; }
static bool HasWedgeNormalOcf() { return false; } static bool HasWedgeNormalOcf() { return false; }
static bool HasFFAdjacencyOcf() { return false; } static bool HasFFAdjacencyOcf() { return false; }
static bool HasVFAdjacencyOcf() { return false; } static bool HasVFAdjacencyOcf() { return false; }
inline bool IsColorEnabled() const { return _ovp->IsColorEnabled();}
inline bool IsCurvatureDirEnabled( ) const { return _ovp->IsCurvatureDirEnabled(); }
inline bool IsMarkEnabled( ) const { return _ovp->IsMarkEnabled(); }
inline bool IsNormalEnabled( ) const { return _ovp->IsNormalEnabled(); }
inline bool IsQualityEnabled( ) const { return _ovp->IsQualityEnabled(); }
inline bool IsWedgeColorEnabled( ) const { return _ovp->IsWedgeColorEnabled(); }
inline bool IsWedgeNormalEnabled( ) const { return _ovp->IsWedgeNormalEnabled(); }
inline bool IsWedgeTexCoordEnabled( ) const { return _ovp->IsWedgeTexCoordEnabled(); }
inline int Index() const { inline int Index() const {
typename T::FaceType const *tp=static_cast<typename T::FaceType const *>(this); typename T::FaceType const *tp=static_cast<typename T::FaceType const *>(this);
int tt2=tp- &*(_ovp->begin()); int tt2=tp- &*(_ovp->begin());
@ -757,7 +770,7 @@ public:
template < class FaceType > template < class FaceType >
bool FaceVectorHasPerWedgeTexCoord(const face::vector_ocf<FaceType> &fv) bool FaceVectorHasPerWedgeTexCoord(const face::vector_ocf<FaceType> &fv)
{ {
if(FaceType::HasWedgeTexCoordOcf()) return fv.IsWedgeTexEnabled(); if(FaceType::HasWedgeTexCoordOcf()) return fv.IsWedgeTexCoordEnabled();
else return FaceType::HasWedgeTexCoord(); else return FaceType::HasWedgeTexCoord();
} }
template < class FaceType > template < class FaceType >