00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef __VCG_FACE_PLUS_COMPONENT_OCF
00033 #define __VCG_FACE_PLUS_COMPONENT_OCF
00034
00035 #include <vcg/simplex/face/component.h>
00036 #include <vector>
00037 #include <limits>
00038
00039
00040 namespace vcg {
00041 namespace face {
00042
00043
00044
00045
00046
00047 template <class VALUE_TYPE>
00048 class vector_ocf: public std::vector<VALUE_TYPE> {
00049 typedef std::vector<VALUE_TYPE> BaseType;
00050 typedef typename vector_ocf<VALUE_TYPE>::iterator ThisTypeIterator;
00051
00052 public:
00053 vector_ocf():std::vector<VALUE_TYPE>(){
00054 ColorEnabled=false;
00055 QualityEnabled=false;
00056 MarkEnabled=false;
00057 NormalEnabled=false;
00058 WedgeTexEnabled=false;
00059 VFAdjacencyEnabled=false;
00060 FFAdjacencyEnabled=false;
00061 WedgeColorEnabled=false;
00062 WedgeNormalEnabled=false;
00063 }
00064
00065
00066 struct AdjTypePack {
00067 typename VALUE_TYPE::FacePointer _fp[3] ;
00068 char _zp[3] ;
00069
00070
00071
00072
00073 AdjTypePack() {
00074 _fp[0]=0;
00075 _fp[1]=0;
00076 _fp[2]=0;
00077 }
00078 };
00079
00080
00081 class WedgeTexTypePack {
00082 public:
00083 WedgeTexTypePack() {
00084 wt[0].U()=.5;wt[0].V()=.5;
00085 wt[1].U()=.5;wt[1].V()=.5;
00086 wt[2].U()=.5;wt[2].V()=.5;
00087 wt[0].N()=-1;
00088 wt[1].N()=-1;
00089 wt[2].N()=-1;
00090 }
00091
00092 typename VALUE_TYPE::TexCoordType wt[3];
00093 };
00094
00095 class WedgeColorTypePack {
00096 public:
00097 WedgeColorTypePack() {
00098 typedef typename VALUE_TYPE::ColorType::ScalarType WedgeColorScalarType;
00099 for (int i=0; i<3; ++i)
00100 {
00101 wc[i][0] = WedgeColorScalarType(255);
00102 wc[i][1] = WedgeColorScalarType(255);
00103 wc[i][2] = WedgeColorScalarType(255);
00104 wc[i][3] = WedgeColorScalarType(255);
00105 }
00106 }
00107
00108 typename VALUE_TYPE::ColorType wc[3];
00109 };
00110
00111 class WedgeNormalTypePack {
00112 public:
00113 WedgeNormalTypePack() {
00114 typedef typename VALUE_TYPE::NormalType::ScalarType WedgeNormalScalarType;
00115 for (int i=0; i<3; ++i)
00116 {
00117 wn[i][0] = WedgeNormalScalarType(0);
00118 wn[i][1] = WedgeNormalScalarType(0);
00119 wn[i][2] = WedgeNormalScalarType(1);
00120 }
00121 }
00122
00123 typename VALUE_TYPE::NormalType wn[3];
00124 };
00125
00126
00127
00128
00129 void push_back(const VALUE_TYPE & v)
00130 {
00131 BaseType::push_back(v);
00132 BaseType::back()._ovp = this;
00133 if (QualityEnabled) QV.push_back(0);
00134 if (ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
00135 if (MarkEnabled) MV.push_back(0);
00136 if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
00137 if (VFAdjacencyEnabled) AV.push_back(AdjTypePack());
00138 if (FFAdjacencyEnabled) AF.push_back(AdjTypePack());
00139 if (WedgeTexEnabled) WTV.push_back(WedgeTexTypePack());
00140 if (WedgeColorEnabled) WCV.push_back(WedgeColorTypePack());
00141 if (WedgeNormalEnabled) WNV.push_back(WedgeNormalTypePack());
00142 }
00143 void pop_back();
00144 void resize(const unsigned int & _size)
00145 {
00146 unsigned int oldsize = BaseType::size();
00147 BaseType::resize(_size);
00148 if(oldsize<_size){
00149 ThisTypeIterator firstnew = BaseType::begin();
00150 advance(firstnew,oldsize);
00151 _updateOVP(firstnew,(*this).end());
00152 }
00153 if (QualityEnabled) QV.resize(_size);
00154 if (ColorEnabled) CV.resize(_size);
00155 if (MarkEnabled) MV.resize(_size);
00156 if (NormalEnabled) NV.resize(_size);
00157 if (VFAdjacencyEnabled) AV.resize(_size);
00158 if (FFAdjacencyEnabled) AF.resize(_size);
00159 if (WedgeTexEnabled) WTV.resize(_size,WedgeTexTypePack());
00160 if (WedgeColorEnabled) WCV.resize(_size);
00161 if (WedgeNormalEnabled) WNV.resize(_size);
00162 }
00163 void reserve(const unsigned int & _size)
00164 {
00165 ThisTypeIterator oldbegin=(*this).begin();
00166 BaseType::reserve(_size);
00167
00168 if (QualityEnabled) QV.reserve(_size);
00169 if (ColorEnabled) CV.reserve(_size);
00170 if (MarkEnabled) MV.reserve(_size);
00171 if (NormalEnabled) NV.reserve(_size);
00172 if (VFAdjacencyEnabled) AV.reserve(_size);
00173 if (FFAdjacencyEnabled) AF.reserve(_size);
00174 if (WedgeTexEnabled) WTV.reserve(_size);
00175 if (WedgeColorEnabled) WCV.reserve(_size);
00176 if (WedgeNormalEnabled) WNV.reserve(_size);
00177
00178 if(oldbegin!=(*this).begin()) _updateOVP((*this).begin(),(*this).end());
00179 }
00180
00181 void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend)
00182 {
00183 ThisTypeIterator fi;
00184
00185 for(fi=lbegin;fi!=lend;++fi)
00186 (*fi)._ovp=this;
00187 }
00188
00189
00190
00191
00192 void ReorderFace(std::vector<size_t> &newFaceIndex )
00193 {
00194 size_t i=0;
00195 if (QualityEnabled) assert( QV.size() == newFaceIndex.size() );
00196 if (ColorEnabled) assert( CV.size() == newFaceIndex.size() );
00197 if (MarkEnabled) assert( MV.size() == newFaceIndex.size() );
00198 if (NormalEnabled) assert( NV.size() == newFaceIndex.size() );
00199 if (VFAdjacencyEnabled) assert( AV.size() == newFaceIndex.size() );
00200 if (FFAdjacencyEnabled) assert( AF.size() == newFaceIndex.size() );
00201 if (WedgeTexEnabled) assert(WTV.size() == newFaceIndex.size() );
00202 if (WedgeColorEnabled) assert(WCV.size() == newFaceIndex.size() );
00203 if (WedgeNormalEnabled) assert(WNV.size() == newFaceIndex.size() );
00204
00205 for(i=0;i<newFaceIndex.size();++i)
00206 {
00207 if(newFaceIndex[i] != std::numeric_limits<size_t>::max() )
00208 {
00209 assert(newFaceIndex[i] <= i);
00210 if (QualityEnabled) QV[newFaceIndex[i]] = QV[i];
00211 if (ColorEnabled) CV[newFaceIndex[i]] = CV[i];
00212 if (MarkEnabled) MV[newFaceIndex[i]] = MV[i];
00213 if (NormalEnabled) NV[newFaceIndex[i]] = NV[i];
00214 if (VFAdjacencyEnabled) AV[newFaceIndex[i]] = AV[i];
00215 if (FFAdjacencyEnabled) AF[newFaceIndex[i]] = AF[i];
00216 if (WedgeTexEnabled) WTV[newFaceIndex[i]] = WTV[i];
00217 if (WedgeColorEnabled) WCV[newFaceIndex[i]] = WCV[i];
00218 if (WedgeNormalEnabled) WNV[newFaceIndex[i]] = WNV[i];
00219 }
00220 }
00221
00222 if (QualityEnabled) QV.resize(BaseType::size());
00223 if (ColorEnabled) CV.resize(BaseType::size());
00224 if (MarkEnabled) MV.resize(BaseType::size());
00225 if (NormalEnabled) NV.resize(BaseType::size());
00226 if (VFAdjacencyEnabled) AV.resize(BaseType::size());
00227 if (FFAdjacencyEnabled) AF.resize(BaseType::size());
00228 if (WedgeTexEnabled) WTV.resize(BaseType::size());
00229 if (WedgeColorEnabled) WCV.resize(BaseType::size());
00230 if (WedgeNormalEnabled) WNV.resize(BaseType::size());
00231 }
00232
00234
00235
00236 bool IsQualityEnabled() const {return QualityEnabled;}
00237 void EnableQuality() {
00238 assert(VALUE_TYPE::HasFaceQualityOcf());
00239 QualityEnabled=true;
00240 QV.resize((*this).size());
00241 }
00242
00243 void DisableQuality() {
00244 assert(VALUE_TYPE::HasFaceQualityOcf());
00245 QualityEnabled=false;
00246 QV.clear();
00247 }
00248
00249 bool IsColorEnabled() const {return ColorEnabled;}
00250 void EnableColor() {
00251 assert(VALUE_TYPE::HasFaceColorOcf());
00252 ColorEnabled=true;
00253 CV.resize((*this).size());
00254 }
00255
00256 void DisableColor() {
00257 assert(VALUE_TYPE::HasFaceColorOcf());
00258 ColorEnabled=false;
00259 CV.clear();
00260 }
00261
00262 bool IsMarkEnabled() const {return MarkEnabled;}
00263 void EnableMark() {
00264 assert(VALUE_TYPE::HasFaceMarkOcf());
00265 MarkEnabled=true;
00266 MV.resize((*this).size());
00267 }
00268
00269 void DisableMark() {
00270 assert(VALUE_TYPE::HasFaceMarkOcf());
00271 MarkEnabled=false;
00272 MV.clear();
00273 }
00274
00275 bool IsNormalEnabled() const {return NormalEnabled;}
00276 void EnableNormal() {
00277 assert(VALUE_TYPE::HasFaceNormalOcf());
00278 NormalEnabled=true;
00279 NV.resize((*this).size());
00280 }
00281
00282 void DisableNormal() {
00283 assert(VALUE_TYPE::HasFaceNormalOcf());
00284 NormalEnabled=false;
00285 NV.clear();
00286 }
00287
00288 bool IsVFAdjacencyEnabled() const {return VFAdjacencyEnabled;}
00289 void EnableVFAdjacency() {
00290 assert(VALUE_TYPE::HasVFAdjacencyOcf());
00291 VFAdjacencyEnabled=true;
00292 AV.resize((*this).size());
00293 }
00294
00295 void DisableVFAdjacency() {
00296 assert(VALUE_TYPE::HasVFAdjacencyOcf());
00297 VFAdjacencyEnabled=false;
00298 AV.clear();
00299 }
00300
00301
00302 bool IsFFAdjacencyEnabled() const {return FFAdjacencyEnabled;}
00303 void EnableFFAdjacency() {
00304 assert(VALUE_TYPE::HasFFAdjacencyOcf());
00305 FFAdjacencyEnabled=true;
00306 AF.resize((*this).size());
00307 }
00308
00309 void DisableFFAdjacency() {
00310 assert(VALUE_TYPE::HasFFAdjacencyOcf());
00311 FFAdjacencyEnabled=false;
00312 AF.clear();
00313 }
00314
00315 bool IsWedgeTexEnabled() const {return WedgeTexEnabled;}
00316 void EnableWedgeTex() {
00317 assert(VALUE_TYPE::HasWedgeTexCoordOcf());
00318 WedgeTexEnabled=true;
00319 WTV.resize((*this).size(),WedgeTexTypePack());
00320 }
00321
00322 void DisableWedgeTex() {
00323 assert(VALUE_TYPE::HasWedgeTexCoordOcf());
00324 WedgeTexEnabled=false;
00325 WTV.clear();
00326 }
00327
00328 bool IsWedgeColorEnabled() const {return WedgeColorEnabled;}
00329 void EnableWedgeColor() {
00330 assert(VALUE_TYPE::HasWedgeColorOcf());
00331 WedgeColorEnabled=true;
00332 WCV.resize((*this).size(),WedgeColorTypePack());
00333 }
00334
00335 void DisableWedgeColor() {
00336 assert(VALUE_TYPE::HasWedgeColorOcf());
00337 WedgeColorEnabled=false;
00338 WCV.clear();
00339 }
00340
00341 bool IsWedgeNormalEnabled() const {return WedgeNormalEnabled;}
00342 void EnableWedgeNormal() {
00343 assert(VALUE_TYPE::HasWedgeNormalOcf());
00344 WedgeNormalEnabled=true;
00345 WNV.resize((*this).size(),WedgeNormalTypePack());
00346 }
00347
00348 void DisableWedgeNormal() {
00349 assert(VALUE_TYPE::HasWedgeNormalOcf());
00350 WedgeNormalEnabled=false;
00351 WNV.clear();
00352 }
00353
00354 public:
00355 std::vector<float> QV;
00356 std::vector<typename VALUE_TYPE::ColorType> CV;
00357 std::vector<int> MV;
00358 std::vector<typename VALUE_TYPE::NormalType> NV;
00359 std::vector<struct AdjTypePack> AV;
00360 std::vector<struct AdjTypePack> AF;
00361 std::vector<class WedgeTexTypePack> WTV;
00362 std::vector<class WedgeColorTypePack> WCV;
00363 std::vector<class WedgeNormalTypePack> WNV;
00364
00365 bool QualityEnabled;
00366 bool ColorEnabled;
00367 bool MarkEnabled;
00368 bool NormalEnabled;
00369 bool WedgeTexEnabled;
00370 bool VFAdjacencyEnabled;
00371 bool FFAdjacencyEnabled;
00372 bool WedgeColorEnabled;
00373 bool WedgeNormalEnabled;
00374 };
00375
00376
00377
00378
00379
00380
00381
00382
00383 template <class T> class VFAdjOcf: public T {
00384 public:
00385 typename T::FacePointer &VFp(const int j) {
00386 assert((*this).Base().VFAdjacencyEnabled);
00387 return (*this).Base().AV[(*this).Index()]._fp[j];
00388 }
00389
00390 typename T::FacePointer cVFp(const int j) const {
00391 if(! (*this).Base().VFAdjacencyEnabled ) return 0;
00392 else return (*this).Base().AV[(*this).Index()]._fp[j];
00393 }
00394
00395 char &VFi(const int j) {
00396 assert((*this).Base().VFAdjacencyEnabled);
00397 return (*this).Base().AV[(*this).Index()]._zp[j];
00398 }
00399
00400 template <class LeftF>
00401 void ImportData(const LeftF & leftF){
00402 T::ImportData(leftF);
00403 }
00404 static bool HasVFAdjacency() { return true; }
00405 static bool HasVFAdjacencyOcf() { return true; }
00406
00407 private:
00408 };
00409
00410
00411
00412 template <class T> class FFAdjOcf: public T {
00413 public:
00414 typename T::FacePointer &FFp(const int j) {
00415 assert((*this).Base().FFAdjacencyEnabled);
00416 return (*this).Base().AF[(*this).Index()]._fp[j];
00417 }
00418
00419 typename T::FacePointer const FFp(const int j) const { return cFFp(j);}
00420 typename T::FacePointer const cFFp(const int j) const {
00421 if(! (*this).Base().FFAdjacencyEnabled ) return 0;
00422 else return (*this).Base().AF[(*this).Index()]._fp[j];
00423 }
00424
00425 char &FFi(const int j) {
00426 assert((*this).Base().FFAdjacencyEnabled);
00427 return (*this).Base().AF[(*this).Index()]._zp[j];
00428 }
00429 char cFFi(const int j) const {
00430 assert((*this).Base().FFAdjacencyEnabled);
00431 return (*this).Base().AF[(*this).Index()]._zp[j];
00432 }
00433
00434 typename T::FacePointer &FFp1( const int j ) { return FFp((j+1)%3);}
00435 typename T::FacePointer &FFp2( const int j ) { return FFp((j+2)%3);}
00436 typename T::FacePointer const FFp1( const int j ) const { return FFp((j+1)%3);}
00437 typename T::FacePointer const FFp2( const int j ) const { return FFp((j+2)%3);}
00438
00439 template <class LeftF>
00440 void ImportData(const LeftF & leftF){
00441 T::ImportData(leftF);
00442 }
00443 static bool HasFFAdjacency() { return true; }
00444 static bool HasFFAdjacencyOcf() { return true; }
00445
00446 private:
00447 };
00448
00449
00450
00451 template <class A, class T> class NormalOcf: public T {
00452 public:
00453 typedef A NormalType;
00454 static bool HasFaceNormal() { return true; }
00455 static bool HasFaceNormalOcf() { return true; }
00456
00457 NormalType &N() {
00458
00459 assert((*this).Base().NormalEnabled);
00460 return (*this).Base().NV[(*this).Index()]; }
00461 const NormalType &cN() const {
00462
00463 assert((*this).Base().NormalEnabled);
00464 return (*this).Base().NV[(*this).Index()]; }
00465
00466 template <class LeftF>
00467 void ImportData(const LeftF & leftF){
00468 if((*this).Base().NormalEnabled && leftF.Base().NormalEnabled)
00469 N() = leftF.cN();
00470 T::ImportData(leftF);
00471 }
00472
00473 };
00474
00475 template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {};
00476 template <class T> class Normal3fOcf: public NormalOcf<vcg::Point3f, T> {};
00477 template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {};
00478
00480
00481 template <class A, class T> class QualityOcf: public T {
00482 public:
00483 typedef A QualityType;
00484 QualityType &Q() {
00485 assert((*this).Base().QualityEnabled);
00486 return (*this).Base().QV[(*this).Index()];
00487 }
00488 const QualityType Q() const {
00489 assert((*this).Base().QualityEnabled);
00490 return (*this).Base().QV[(*this).Index()];
00491 }
00492 const QualityType cQ() const {
00493 assert((*this).Base().QualityEnabled);
00494 return (*this).Base().QV[(*this).Index()];
00495 }
00496
00497 template <class LeftF>
00498 void ImportData(const LeftF & leftF){
00499
00500 if((*this).Base().QualityEnabled)
00501 Q() = leftF.cQ();
00502 T::ImportData(leftF);
00503 }
00504 static bool HasFaceQuality() { return true; }
00505 static bool HasFaceQualityOcf() { return true; }
00506 };
00507
00508 template <class T> class QualityfOcf: public QualityOcf<float, T> {};
00509
00511
00512 template <class A, class T> class ColorOcf: public T {
00513 public:
00514 typedef A ColorType;
00515 ColorType &C() {
00516 assert((*this).Base().ColorEnabled);
00517 return (*this).Base().CV[(*this).Index()];
00518 }
00519 const ColorType C() const {
00520 assert((*this).Base().ColorEnabled);
00521 return (*this).Base().CV[(*this).Index()];
00522 }
00523 const ColorType cC() const {
00524 assert((*this).Base().ColorEnabled);
00525 return (*this).Base().CV[(*this).Index()];
00526 }
00527
00528 template <class LeftF>
00529 void ImportData(const LeftF & leftF){
00530
00531 if((*this).Base().ColorEnabled )
00532 C() = leftF.cC();
00533 T::ImportData(leftF);
00534 }
00535 static bool HasFaceColor() { return true; }
00536 static bool HasFaceColorOcf() { return true; }
00537 };
00538
00539 template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
00540
00542
00543 template <class T> class MarkOcf: public T {
00544 public:
00545 inline int & IMark() {
00546 assert((*this).Base().MarkEnabled);
00547 return (*this).Base().MV[(*this).Index()];
00548 }
00549
00550 inline int IMark() const {
00551 assert((*this).Base().MarkEnabled);
00552 return (*this).Base().MV[(*this).Index()];
00553 } ;
00554
00555 template <class LeftF>
00556 void ImportData(const LeftF & leftF){
00557
00558 if((*this).Base().MarkEnabled)
00559 IMark() = leftF.IMark();
00560 T::ImportData(leftF);
00561 }
00562 static bool HasFaceMark() { return true; }
00563 static bool HasFaceMarkOcf() { return true; }
00564 inline void InitIMark() { IMark() = 0; }
00565 };
00566
00568
00569 template <class A, class TT> class WedgeTexCoordOcf: public TT {
00570 public:
00571 WedgeTexCoordOcf(){ }
00572 typedef A TexCoordType;
00573 TexCoordType &WT(const int i) { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
00574 TexCoordType const &cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
00575 template <class LeftF>
00576 void ImportData(const LeftF & leftF){
00577
00578 if(this->Base().WedgeTexEnabled)
00579 { WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); }
00580 TT::ImportData(leftF);
00581 }
00582 static bool HasWedgeTexCoord() { return true; }
00583 static bool HasWedgeTexCoordOcf() { return true; }
00584 };
00585
00586 template <class T> class WedgeTexCoordfOcf: public WedgeTexCoordOcf<TexCoord2<float,1>, T> {};
00587
00589
00590 template <class A, class TT> class WedgeColorOcf: public TT {
00591 public:
00592 WedgeColorOcf(){ }
00593 typedef A ColorType;
00594 ColorType &WC(const int i) { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; }
00595 const ColorType & cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; }
00596 template <class LeftF>
00597 void ImportData(const LeftF & leftF){
00598
00599 if(this->Base().WedgeColorEnabled)
00600 { WC(0) = leftF.cWC(0); WC(1) = leftF.cWC(1); WC(2) = leftF.cWC(2); }
00601 TT::ImportData(leftF);
00602 }
00603 static bool HasWedgeColor() { return true; }
00604 static bool HasWedgeColorOcf() { return true; }
00605 };
00606
00607 template <class T> class WedgeColor4bOcf: public WedgeColorOcf<vcg::Color4b, T> {};
00608
00610
00611 template <class A, class TT> class WedgeNormalOcf: public TT {
00612 public:
00613 WedgeNormalOcf(){ }
00614 typedef A NormalType;
00615 NormalType &WN(const int i) { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; }
00616 NormalType const &cWN(const int i) const { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; }
00617 template <class LeftF>
00618 void ImportData(const LeftF & leftF){
00619
00620 if(this->Base().WedgeNormalEnabled)
00621 { WN(0) = leftF.cWN(0); WN(1) = leftF.cWN(1); WN(2) = leftF.cWN(2); }
00622 TT::ImportData(leftF);
00623 }
00624 static bool HasWedgeNormal() { return true; }
00625 static bool HasWedgeNormalOcf() { return true; }
00626 };
00627
00628 template <class T> class WedgeNormal3sOcf: public WedgeNormalOcf<vcg::Point3s, T> {};
00629 template <class T> class WedgeNormal3fOcf: public WedgeNormalOcf<vcg::Point3f, T> {};
00630 template <class T> class WedgeNormal3dOcf: public WedgeNormalOcf<vcg::Point3d, T> {};
00631
00633
00634 template < class T> class InfoOcf: public T {
00635 public:
00636
00637
00638 inline InfoOcf &operator=(const InfoOcf & ) {
00639 assert(0); return *this;
00640 }
00641
00642
00643 vector_ocf<typename T::FaceType> &Base() const { return *_ovp;}
00644
00645 template <class LeftF>
00646 void ImportData(const LeftF & leftF){T::ImportData(leftF);}
00647
00648 static bool HasFaceColorOcf() { return false; }
00649 static bool HasFaceNormalOcf() { return false; }
00650 static bool HasFaceMarkOcf() { return false; }
00651 static bool HasWedgeTexCoordOcf() { return false; }
00652 static bool HasFFAdjacencyOcf() { return false; }
00653 static bool HasVFAdjacencyOcf() { return false; }
00654
00655
00656 inline int Index() const {
00657 typename T::FaceType const *tp=static_cast<typename T::FaceType const *>(this);
00658 int tt2=tp- &*(_ovp->begin());
00659 return tt2;
00660 }
00661 public:
00662
00663
00664
00665 vector_ocf<typename T::FaceType> *_ovp;
00666 };
00667
00668 }
00669
00670 template < class, class,class,class > class TriMesh;
00671
00672 namespace tri
00673 {
00674
00675
00676 template < class VertContainerType, class FaceType, class Container1, class Container2 >
00677 bool HasPerFaceVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
00678 {
00679 if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
00680 else return FaceType::FaceType::HasVFAdjacency();
00681 }
00682
00683 template < class VertContainerType, class FaceType, class Container1, class Container2 >
00684 bool HasFFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
00685 {
00686 if(FaceType::HasFFAdjacencyOcf()) return m.face.IsFFAdjacencyEnabled();
00687 else return FaceType::FaceType::HasFFAdjacency();
00688 }
00689
00690 template < class VertContainerType, class FaceType, class Container1, class Container2 >
00691 bool HasPerWedgeTexCoord (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
00692 {
00693 if(FaceType::HasWedgeTexCoordOcf()) return m.face.IsWedgeTexEnabled();
00694 else return FaceType::HasWedgeTexCoord();
00695 }
00696
00697 template < class VertContainerType, class FaceType, class Container1, class Container2 >
00698 bool HasPerFaceColor (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
00699 {
00700 if(FaceType::HasFaceColorOcf()) return m.face.IsColorEnabled();
00701 else return FaceType::HasFaceColor();
00702 }
00703
00704 template < class VertContainerType, class FaceType, class Container1, class Container2 >
00705 bool HasPerFaceQuality (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
00706 {
00707 if(FaceType::HasFaceQualityOcf()) return m.face.IsQualityEnabled();
00708 else return FaceType::HasFaceQuality();
00709 }
00710
00711 template < class VertContainerType, class FaceType, class Container1, class Container2 >
00712 bool HasPerFaceMark (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
00713 {
00714 if(FaceType::HasFaceMarkOcf()) return m.face.IsMarkEnabled();
00715 else return FaceType::HasFaceMark();
00716 }
00717
00718 template < class FaceType >
00719 void ReorderFace( std::vector<size_t> &newFaceIndex, face::vector_ocf< FaceType > &faceVec)
00720 {
00721 faceVec.ReorderFace(newFaceIndex);
00722 }
00723
00724 }
00725 }
00726 #endif