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
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 #ifndef __VCG_VERTEX_PLUS_COMPONENT_OCF
00092 #define __VCG_VERTEX_PLUS_COMPONENT_OCF
00093
00094 #include <vcg/simplex/vertex/component.h>
00095
00096 #include <vector>
00097 #include <limits>
00098
00099 namespace vcg {
00100 namespace vertex {
00101
00102
00103
00104
00105 template <class VALUE_TYPE>
00106 class vector_ocf: public std::vector<VALUE_TYPE> {
00107 typedef std::vector<VALUE_TYPE> BaseType;
00108 typedef typename vector_ocf<VALUE_TYPE>::iterator ThisTypeIterator;
00109
00110 public:
00111 vector_ocf():std::vector<VALUE_TYPE>(){
00112 ColorEnabled = false;
00113 CurvatureEnabled = false;
00114 CurvatureDirEnabled = false;
00115 MarkEnabled = false;
00116 NormalEnabled = false;
00117 QualityEnabled = false;
00118 RadiusEnabled = false;
00119 TexCoordEnabled = false;
00120 VFAdjacencyEnabled = false;
00121 }
00122
00123
00124
00125 void push_back(const VALUE_TYPE & v)
00126 {
00127 BaseType::push_back(v);
00128 BaseType::back()._ovp = this;
00129 if (ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
00130 if (MarkEnabled) MV.push_back(0);
00131 if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
00132 if (TexCoordEnabled) TV.push_back(typename VALUE_TYPE::TexCoordType());
00133 if (VFAdjacencyEnabled) AV.push_back(VFAdjType());
00134 if (CurvatureEnabled) CuV.push_back(typename VALUE_TYPE::CurvatureType());
00135 if (CurvatureDirEnabled) CuDV.push_back(typename VALUE_TYPE::CurvatureDirType());
00136 if (RadiusEnabled) RadiusV.push_back(typename VALUE_TYPE::RadiusType());
00137 }
00138 void pop_back();
00139 void resize(const unsigned int & _size)
00140 {
00141 const unsigned int oldsize = BaseType::size();
00142 BaseType::resize(_size);
00143 if(oldsize<_size){
00144 ThisTypeIterator firstnew = BaseType::begin();
00145 advance(firstnew,oldsize);
00146 _updateOVP(firstnew,(*this).end());
00147 }
00148 if (ColorEnabled) CV.resize(_size);
00149 if (MarkEnabled) MV.resize(_size);
00150 if (NormalEnabled) NV.resize(_size);
00151 if (TexCoordEnabled) TV.resize(_size);
00152 if (VFAdjacencyEnabled) AV.resize(_size);
00153 if (CurvatureEnabled) CuV.resize(_size);
00154 if (CurvatureDirEnabled) CuDV.resize(_size);
00155 if (RadiusEnabled) RadiusV.resize(_size);
00156 }
00157
00158 void reserve(const unsigned int & _size)
00159 {
00160 BaseType::reserve(_size);
00161 if (ColorEnabled) CV.reserve(_size);
00162 if (MarkEnabled) MV.reserve(_size);
00163 if (NormalEnabled) NV.reserve(_size);
00164 if (TexCoordEnabled) TV.reserve(_size);
00165 if (VFAdjacencyEnabled) AV.reserve(_size);
00166 if (CurvatureEnabled) CuV.reserve(_size);
00167 if (CurvatureDirEnabled) CuDV.reserve(_size);
00168 if (RadiusEnabled) RadiusV.reserve(_size);
00169 }
00170
00171 void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend)
00172 {
00173 ThisTypeIterator vi;
00174 for(vi=lbegin;vi!=lend;++vi)
00175 (*vi)._ovp=this;
00176 }
00177
00178
00179 void ReorderVert(std::vector<size_t> &newVertIndex )
00180 {
00181 size_t i=0;
00182 assert( (!ColorEnabled) || ( CV.size() == newVertIndex.size() ) );
00183 assert( (!MarkEnabled) || ( MV.size() == newVertIndex.size() ) );
00184 assert( (!NormalEnabled) || ( NV.size() == newVertIndex.size() ) );
00185 assert( (!VFAdjacencyEnabled) || ( AV.size() == newVertIndex.size() ) );
00186 assert( (!CurvatureEnabled) || ( CuV.size() == newVertIndex.size() ) );
00187 assert( (!CurvatureDirEnabled) || ( CuDV.size() == newVertIndex.size() ) );
00188 assert( (!RadiusEnabled) || ( RadiusV.size() == newVertIndex.size() ) );
00189 assert( (!TexCoordEnabled) || ( TV.size() == newVertIndex.size() ) );
00190
00191 for(i=0;i<newVertIndex.size();++i)
00192 {
00193 if(newVertIndex[i] != std::numeric_limits<size_t>::max() )
00194 {
00195 assert(newVertIndex[i] <= i);
00196 if (ColorEnabled) CV[newVertIndex[i]] = CV[i];
00197 if (MarkEnabled) MV[newVertIndex[i]] = MV[i];
00198 if (NormalEnabled) NV[newVertIndex[i]] = NV[i];
00199 if (VFAdjacencyEnabled) AV[newVertIndex[i]] = AV[i];
00200 if (CurvatureEnabled) CuV[newVertIndex[i]] = CuV[i];
00201 if (CurvatureDirEnabled) CuDV[newVertIndex[i]] =CuDV[i];
00202 if (RadiusEnabled) RadiusV[newVertIndex[i]] = RadiusV[i];
00203 if (TexCoordEnabled) TV[newVertIndex[i]] = TV[i];
00204 }
00205 }
00206
00207 if (ColorEnabled) CV.resize(BaseType::size());
00208 if (MarkEnabled) MV.resize(BaseType::size());
00209 if (NormalEnabled) NV.resize(BaseType::size());
00210 if (VFAdjacencyEnabled) AV.resize(BaseType::size());
00211 if (CurvatureEnabled) CuV.resize(BaseType::size());
00212 if (CurvatureDirEnabled) CuDV.resize(BaseType::size());
00213 if (RadiusEnabled) RadiusV.resize(BaseType::size());
00214 if (TexCoordEnabled) TV.resize(BaseType::size());
00215 }
00216
00217
00218
00220
00221
00222 bool IsQualityEnabled() const {return QualityEnabled;}
00223 void EnableQuality() {
00224 assert(VALUE_TYPE::HasQualityOcf());
00225 QualityEnabled=true;
00226 QV.resize((*this).size());
00227 }
00228
00229 void DisableQuality() {
00230 assert(VALUE_TYPE::HasQualityOcf());
00231 QualityEnabled=false;
00232 QV.clear();
00233 }
00234
00235 bool IsColorEnabled() const {return ColorEnabled;}
00236 void EnableColor() {
00237 assert(VALUE_TYPE::HasColorOcf());
00238 ColorEnabled=true;
00239 CV.resize((*this).size());
00240 }
00241
00242 void DisableColor() {
00243 assert(VALUE_TYPE::HasColorOcf());
00244 ColorEnabled=false;
00245 CV.clear();
00246 }
00247
00248 bool IsMarkEnabled() const {return MarkEnabled;}
00249 void EnableMark() {
00250 assert(VALUE_TYPE::HasMarkOcf());
00251 MarkEnabled=true;
00252 MV.resize((*this).size());
00253 }
00254
00255 void DisableMark() {
00256 assert(VALUE_TYPE::HasMarkOcf());
00257 MarkEnabled=false;
00258 MV.clear();
00259 }
00260
00261 bool IsNormalEnabled() const {return NormalEnabled;}
00262 void EnableNormal() {
00263 assert(VALUE_TYPE::HasNormalOcf());
00264 NormalEnabled=true;
00265 NV.resize((*this).size());
00266 }
00267
00268 void DisableNormal() {
00269 assert(VALUE_TYPE::HasNormalOcf());
00270 NormalEnabled=false;
00271 NV.clear();
00272 }
00273
00274 bool IsVFAdjacencyEnabled() const {return VFAdjacencyEnabled;}
00275 void EnableVFAdjacency() {
00276 assert(VALUE_TYPE::HasVFAdjacencyOcf());
00277 VFAdjacencyEnabled=true;
00278 AV.resize((*this).size());
00279 }
00280
00281 void DisableVFAdjacency() {
00282 assert(VALUE_TYPE::HasVFAdjacencyOcf());
00283 VFAdjacencyEnabled=false;
00284 AV.clear();
00285 }
00286
00287 bool IsCurvatureEnabled() const {return CurvatureEnabled;}
00288 void EnableCurvature() {
00289 assert(VALUE_TYPE::HasCurvatureOcf());
00290 CurvatureEnabled=true;
00291 CuV.resize((*this).size());
00292 }
00293
00294 void DisableCurvature() {
00295 assert(VALUE_TYPE::HasCurvatureOcf());
00296 CurvatureEnabled=false;
00297 CuV.clear();
00298 }
00299
00300 bool IsCurvatureDirEnabled() const {return CurvatureDirEnabled;}
00301 void EnableCurvatureDir() {
00302 assert(VALUE_TYPE::HasCurvatureDirOcf());
00303 CurvatureDirEnabled=true;
00304 CuDV.resize((*this).size());
00305 }
00306
00307 void DisableCurvatureDir() {
00308 assert(VALUE_TYPE::HasCurvatureDirOcf());
00309 CurvatureDirEnabled=false;
00310 CuDV.clear();
00311 }
00312
00313 bool IsRadiusEnabled() const {return RadiusEnabled;}
00314 void EnableRadius() {
00315 assert(VALUE_TYPE::HasRadiusOcf());
00316 RadiusEnabled=true;
00317 RadiusV.resize((*this).size());
00318 }
00319
00320 void DisableRadius() {
00321 assert(VALUE_TYPE::HasRadiusOcf());
00322 RadiusEnabled=false;
00323 RadiusV.clear();
00324 }
00325
00326
00327 bool IsTexCoordEnabled() const {return TexCoordEnabled;}
00328 void EnableTexCoord() {
00329 assert(VALUE_TYPE::HasTexCoordOcf());
00330 TexCoordEnabled=true;
00331 TV.resize((*this).size());
00332 }
00333
00334 void DisableTexCoord() {
00335 assert(VALUE_TYPE::HasTexCoordOcf());
00336 TexCoordEnabled=false;
00337 TV.clear();
00338 }
00339 struct VFAdjType {
00340 typename VALUE_TYPE::FacePointer _fp ;
00341 int _zp ;
00342 };
00343
00344 public:
00345 std::vector<typename VALUE_TYPE::ColorType> CV;
00346 std::vector<typename VALUE_TYPE::CurvatureType> CuV;
00347 std::vector<typename VALUE_TYPE::CurvatureDirType> CuDV;
00348 std::vector<int> MV;
00349 std::vector<typename VALUE_TYPE::NormalType> NV;
00350 std::vector<typename VALUE_TYPE::QualityType> QV;
00351 std::vector<typename VALUE_TYPE::RadiusType> RadiusV;
00352 std::vector<typename VALUE_TYPE::TexCoordType> TV;
00353 std::vector<struct VFAdjType> AV;
00354
00355 bool ColorEnabled;
00356 bool CurvatureEnabled;
00357 bool CurvatureDirEnabled;
00358 bool MarkEnabled;
00359 bool NormalEnabled;
00360 bool QualityEnabled;
00361 bool RadiusEnabled;
00362 bool TexCoordEnabled;
00363 bool VFAdjacencyEnabled;
00364 };
00365
00366
00367
00368
00369
00370
00371
00372
00373 template <class T> class VFAdjOcf: public T {
00374 public:
00375 typename T::FacePointer &VFp() {
00376 assert((*this).Base().VFAdjacencyEnabled);
00377 return (*this).Base().AV[(*this).Index()]._fp;
00378 }
00379
00380 typename T::FacePointer cVFp() const {
00381 if(! (*this).Base().VFAdjacencyEnabled ) return 0;
00382 else return (*this).Base().AV[(*this).Index()]._fp;
00383 }
00384
00385 int &VFi() {
00386 assert((*this).Base().VFAdjacencyEnabled);
00387 return (*this).Base().AV[(*this).Index()]._zp;
00388 }
00389 int cVFi() const {
00390 if(! (*this).Base().VFAdjacencyEnabled ) return -1;
00391 return (*this).Base().AV[(*this).Index()]._zp;
00392 }
00393 template <class LeftV>
00394 void ImportData(const LeftV & leftV)
00395 {
00396 T::ImportData(leftV);
00397 }
00398
00399 static bool HasVFAdjacency() { return true; }
00400 static bool HasVFAdjacencyOcf() { return true; }
00401 static bool IsVFAdjacencyEnabled(const typename T::VertexType *vp) {return vp->Base().VFAdjacencyEnabled;}
00402
00403 private:
00404 };
00405
00406
00407
00408 template <class A, class T> class NormalOcf: public T {
00409 public:
00410 typedef A NormalType;
00411 static bool HasNormal() { return true; }
00412 static bool HasNormalOcf() { return true; }
00413
00414 NormalType &N() {
00415
00416 assert((*this).Base().NormalEnabled);
00417 return (*this).Base().NV[(*this).Index()]; }
00418 const NormalType &N() const {
00419
00420 assert((*this).Base().NormalEnabled);
00421 return (*this).Base().NV[(*this).Index()]; }
00422
00423 const NormalType &cN() const {
00424
00425 assert((*this).Base().NormalEnabled);
00426 return (*this).Base().NV[(*this).Index()]; }
00427
00428 template <class LeftV>
00429 void ImportData(const LeftV & leftV){
00430 if((*this).Base().NormalEnabled && leftV.Base().NormalEnabled )
00431 N().Import(leftV.cN());
00432 T::ImportData(leftV);}
00433 };
00434
00435 template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {};
00436 template <class T> class Normal3fOcf: public NormalOcf<vcg::Point3f, T> {};
00437 template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {};
00438
00440
00441 template <class A, class T> class ColorOcf: public T {
00442 public:
00443 typedef A ColorType;
00444 ColorType &C() { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
00445 const ColorType &cC() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
00446 template <class LeftV>
00447 void ImportData(const LeftV & leftV)
00448 {
00449 if((*this).Base().ColorEnabled && leftV.Base().ColorEnabled )
00450 C() = leftV.cC();
00451 T::ImportData(leftV);
00452 }
00453
00454 static bool HasColor() { return true; }
00455 static bool HasColorOcf() { assert(!T::HasColorOcf()); return true; }
00456 };
00457
00458 template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
00459
00461
00462 template <class A, class T> class QualityOcf: public T {
00463 public:
00464 typedef A QualityType;
00465 QualityType &Q() { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
00466 template <class LeftV>
00467 void ImportData(const LeftV & leftV)
00468 {
00469
00470 if((*this).Base().QualityEnabled && leftV.HasQuality() )
00471 Q() = leftV.cQ();
00472 T::ImportData(leftV);
00473 }
00474 static bool HasQuality() { return true; }
00475 static bool HasQualityOcf() { assert(!T::HasQualityOcf()); return true; }
00476 };
00477
00478 template <class T> class QualityfOcf: public QualityOcf<float, T> {};
00479
00480
00482
00483 template <class A, class TT> class TexCoordOcf: public TT {
00484 public:
00485 typedef A TexCoordType;
00486 TexCoordType &T() { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
00487 const TexCoordType &cT() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
00488 template < class LeftV>
00489 void ImportData(const LeftV & leftV)
00490 {
00491
00492 if((*this).Base().TexCoordEnabled)
00493 T() = leftV.cT();
00494 TT::ImportData(leftV);
00495 }
00496 static bool HasTexCoord() { return true; }
00497 static bool HasTexCoordOcf() { assert(!TT::HasTexCoordOcf()); return true; }
00498 };
00499
00500 template <class T> class TexCoordfOcf: public TexCoordOcf<TexCoord2<float,1>, T> {};
00501
00503
00504 template <class T> class MarkOcf: public T {
00505 public:
00506 typedef int MarkType;
00507 inline int & IMark() {
00508 assert((*this).Base().MarkEnabled);
00509 return (*this).Base().MV[(*this).Index()];
00510 }
00511
00512 inline int IMark() const {
00513 assert((*this).Base().MarkEnabled);
00514 return (*this).Base().MV[(*this).Index()];
00515 }
00516
00517 template <class LeftV>
00518 void ImportData(const LeftV & leftV)
00519 {
00520
00521 if((*this).Base().MarkEnabled)
00522 IMark() = leftV.IMark();
00523 T::ImportData(leftV);
00524 }
00525 static bool HasMark() { return true; }
00526 static bool HasMarkOcf() { return true; }
00527 inline void InitIMark() { IMark() = 0; }
00528 };
00529
00530
00532
00533 template <class A, class TT> class CurvatureOcf: public TT {
00534 public:
00535 typedef Point2<A> CurvatureType;
00536 typedef typename CurvatureType::ScalarType ScalarType;
00537
00538 ScalarType &Kh(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
00539 ScalarType &Kg(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
00540 const ScalarType &cKh() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
00541 const ScalarType &cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
00542
00543 template <class LeftV>
00544 void ImportData(const LeftV & leftV){
00545
00546 if((*this).Base().CurvatureEnabled && LeftV::IsCurvatureEnabled(&leftV))
00547 {
00548 (*this).Base().CuV[(*this).Index()][0] = leftV.cKh();
00549 (*this).Base().CuV[(*this).Index()][1] = leftV.cKg();
00550 }
00551 TT::ImportData(leftV);
00552 }
00553
00554 static bool HasCurvature() { return true; }
00555 static bool IsCurvatureEnabled(const typename TT::VertexType *v) { return v->Base().CurvatureEnabled; }
00556
00557 static bool HasCurvatureOcf() { return true; }
00558 static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureOcf"));TT::Name(name);}
00559
00560 private:
00561 };
00562
00563 template <class T> class CurvaturefOcf: public CurvatureOcf<float, T> {};
00564 template <class T> class CurvaturedOcf: public CurvatureOcf<double, T> {};
00565
00566
00568
00569 template <class S>
00570 struct CurvatureDirTypeOcf{
00571 typedef Point3<S> VecType;
00572 typedef S ScalarType;
00573 CurvatureDirTypeOcf () {}
00574 Point3<S>max_dir,min_dir;
00575 S k1,k2;
00576 };
00577
00578
00579 template <class A, class TT> class CurvatureDirOcf: public TT {
00580 public:
00581 typedef A CurvatureDirType;
00582 typedef typename CurvatureDirType::VecType VecType;
00583 typedef typename CurvatureDirType::ScalarType ScalarType;
00584
00585 VecType &PD1(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;}
00586 VecType &PD2(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;}
00587 const VecType &cPD1() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;}
00588 const VecType &cPD2() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;}
00589
00590 ScalarType &K1(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;}
00591 ScalarType &K2(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
00592 const ScalarType &cK1() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;}
00593 const ScalarType &cK2()const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
00594
00595 template <class LeftV>
00596 void ImportData(const LeftV & leftV){
00597
00598 if((*this).Base().CurvatureDirEnabled && LeftV::IsCurvatureDirEnabled(&leftV))
00599 {
00600 (*this).PD1() = leftV.cPD1();
00601 (*this).PD2() = leftV.cPD2();
00602 (*this).K1() = leftV.cK1();
00603 (*this).K2() = leftV.cK2();
00604 }
00605 TT::ImportData(leftV);
00606 }
00607 static bool HasCurvatureDir() { return true; }
00608 static bool HasCurvatureDirOcf() { return true; }
00609 static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirOcf"));TT::Name(name);}
00610
00611 private:
00612 };
00613
00614
00615 template <class T> class CurvatureDirfOcf: public CurvatureDirOcf<CurvatureDirTypeOcf<float>, T> {
00616 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirfOcf"));T::Name(name);}
00617 };
00618 template <class T> class CurvatureDirdOcf: public CurvatureDirOcf<CurvatureDirTypeOcf<double>, T> {
00619 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirdOcf"));T::Name(name);}
00620 };
00621
00622
00624
00625 template <class A, class TT> class RadiusOcf: public TT {
00626 public:
00627 typedef A RadiusType;
00628 typedef RadiusType ScalarType;
00629
00630 RadiusType &R(){ assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
00631 const RadiusType &cR() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
00632
00633 template <class LeftV>
00634 void ImportData(const LeftV & leftV)
00635 {
00636
00637 if ((*this).Base().RadiusEnabled)
00638 (*this).Base().RadiusV[(*this).Index()] = leftV.cR();
00639 TT::ImportData(leftV);
00640 }
00641
00642 static bool HasRadius() { return true; }
00643 static bool HasRadiusOcf() { return true; }
00644 static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusOcf")); TT::Name(name);}
00645
00646 private:
00647 };
00648
00649 template <class T> class RadiusfOcf: public RadiusOcf<float, T> {};
00650 template <class T> class RadiusdOcf: public RadiusOcf<double, T> {};
00651
00652
00654
00655 template < class T> class InfoOcf: public T {
00656 public:
00657
00658
00659 inline InfoOcf &operator=(const InfoOcf & ) {
00660 assert(0); return *this;
00661 }
00662
00663 vector_ocf<typename T::VertexType> &Base() const { return *_ovp;}
00664
00665 inline int Index() const {
00666 typename T::VertexType const *tp=static_cast<typename T::VertexType const*>(this);
00667 int tt2=tp- &*(_ovp->begin());
00668 return tt2;
00669 }
00670 public:
00671 vector_ocf<typename T::VertexType> *_ovp;
00672
00673 static bool HasQualityOcf() { return false; }
00674 static bool HasTexCoordOcf() { return false; }
00675 static bool HasVFAdjacencyOcf() { return false; }
00676 };
00677
00678
00679 }
00680
00681
00682 namespace tri
00683 {
00684
00685 template < class, class,class, class> class TriMesh;
00686
00687 template < class VertexType, class ContainerType0, class Container1, class Container2 >
00688 bool HasPerVertexVFAdjacency (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, Container1, Container2 > & m)
00689 {
00690 if(VertexType::HasVFAdjacencyOcf()) return m.vert.IsVFAdjacencyEnabled();
00691 else return VertexType::HasVFAdjacency();
00692 }
00693
00694 template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2 >
00695 bool HasPerVertexRadius (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2 > & m)
00696 {
00697 if(VertexType::HasRadiusOcf()) return m.vert.IsRadiusEnabled();
00698 else return VertexType::HasRadius();
00699 }
00700
00701 template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2>
00702 bool HasPerVertexQuality (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2> & m)
00703 {
00704 if(VertexType::HasQualityOcf()) return m.vert.IsQualityEnabled();
00705 else return VertexType::HasQuality();
00706 }
00707
00708 template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2 >
00709 bool HasPerVertexTexCoord (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2> & m)
00710 {
00711 if(VertexType::HasTexCoordOcf()) return m.vert.IsTexCoordEnabled();
00712 else return VertexType::HasTexCoord();
00713 }
00714
00715 template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2 >
00716 bool HasPerVertexNormal (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2> & m)
00717 {
00718 if(VertexType::HasNormalOcf()) return m.vert.IsNormalEnabled();
00719 else return VertexType::HasNormal();
00720 }
00721
00722 template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2>
00723 bool HasPerVertexColor (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2> & m)
00724 {
00725 if(VertexType::HasColorOcf()) return m.vert.IsColorEnabled();
00726 else return VertexType::HasColor();
00727 }
00728
00729 template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2 >
00730 bool HasPerVertexCurvature (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2 > & m)
00731 {
00732 if(VertexType::HasCurvatureOcf()) return m.vert.IsCurvatureEnabled();
00733 else return VertexType::HasCurvature();
00734 }
00735
00736 template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2>
00737 bool HasPerVertexCurvatureDir (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2 > & m)
00738 {
00739 if(VertexType::HasCurvatureDirOcf()) return m.vert.IsCurvatureDirEnabled();
00740 else return VertexType::HasCurvatureDir();
00741 }
00742
00743 template < class VertexType >
00744 void ReorderVert( std::vector<size_t> &newVertIndex, vertex::vector_ocf< VertexType > &vertVec)
00745 {
00746 vertVec.ReorderVert(newVertIndex);
00747 }
00748 }
00749 }
00750 #endif