2008-12-19 11:31:56 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* VCGLib o o *
|
|
|
|
* Visual and Computer Graphics Library o o *
|
|
|
|
* _ O _ *
|
|
|
|
* Copyright(C) 2004 \/)\/ *
|
|
|
|
* Visual Computing Lab /\/| *
|
|
|
|
* ISTI - Italian National Research Council | *
|
|
|
|
* \ *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
|
|
|
* for more details. *
|
|
|
|
* *
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
OCF = Optional Component Fast (hopefully)
|
|
|
|
compare with OCC(Optional Component Compact)
|
2012-10-25 23:29:10 +02:00
|
|
|
*/
|
|
|
|
#ifndef __VCG_MESH
|
|
|
|
#error "This file should not be included alone. It is automatically included by complex.h"
|
|
|
|
#endif
|
2008-12-19 11:31:56 +01:00
|
|
|
#ifndef __VCG_VERTEX_PLUS_COMPONENT_OCF
|
|
|
|
#define __VCG_VERTEX_PLUS_COMPONENT_OCF
|
2012-10-15 11:17:48 +02:00
|
|
|
#ifndef __VCG_MESH
|
|
|
|
#error "This file should not be included alone. It is automatically included by complex.h"
|
|
|
|
#endif
|
2008-12-19 11:31:56 +01:00
|
|
|
|
|
|
|
namespace vcg {
|
2014-06-19 10:31:51 +02:00
|
|
|
namespace vertex {
|
2008-12-19 11:31:56 +01:00
|
|
|
/*
|
|
|
|
All the Components that can be added to a vertex should be defined in the namespace vert:
|
|
|
|
|
|
|
|
*/
|
|
|
|
template <class VALUE_TYPE>
|
|
|
|
class vector_ocf: public std::vector<VALUE_TYPE> {
|
2014-06-19 10:31:51 +02:00
|
|
|
typedef std::vector<VALUE_TYPE> BaseType;
|
|
|
|
typedef typename vector_ocf<VALUE_TYPE>::iterator ThisTypeIterator;
|
2008-12-19 11:31:56 +01:00
|
|
|
|
|
|
|
public:
|
2012-10-15 11:17:48 +02:00
|
|
|
vector_ocf():std::vector<VALUE_TYPE>()
|
|
|
|
{
|
|
|
|
ColorEnabled = false;
|
2010-04-20 02:57:25 +02:00
|
|
|
CurvatureEnabled = false;
|
|
|
|
CurvatureDirEnabled = false;
|
|
|
|
MarkEnabled = false;
|
2012-10-15 11:17:48 +02:00
|
|
|
NormalEnabled = false;
|
2010-04-20 02:57:25 +02:00
|
|
|
QualityEnabled = false;
|
|
|
|
RadiusEnabled = false;
|
|
|
|
TexCoordEnabled = false;
|
2012-10-15 11:17:48 +02:00
|
|
|
VFAdjacencyEnabled = false;
|
|
|
|
}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2012-10-15 11:17:48 +02:00
|
|
|
////////////////////////////////////////
|
|
|
|
// All the standard methods of std::vector that can change the reallocation are
|
|
|
|
// redefined in order to manage the additional data.
|
|
|
|
void push_back(const VALUE_TYPE & v)
|
2013-09-24 15:55:23 +02:00
|
|
|
{
|
|
|
|
BaseType::push_back(v);
|
|
|
|
BaseType::back()._ovp = this;
|
|
|
|
if (ColorEnabled) CV.push_back(vcg::Color4b(vcg::Color4b::White));
|
|
|
|
if (QualityEnabled) QV.push_back(0);
|
|
|
|
if (MarkEnabled) MV.push_back(0);
|
|
|
|
if (NormalEnabled) NV.push_back(typename VALUE_TYPE::NormalType());
|
|
|
|
if (TexCoordEnabled) TV.push_back(typename VALUE_TYPE::TexCoordType());
|
|
|
|
if (VFAdjacencyEnabled) AV.push_back(VFAdjType());
|
|
|
|
if (CurvatureEnabled) CuV.push_back(typename VALUE_TYPE::CurvatureType());
|
|
|
|
if (CurvatureDirEnabled) CuDV.push_back(typename VALUE_TYPE::CurvatureDirType());
|
|
|
|
if (RadiusEnabled) RadiusV.push_back(typename VALUE_TYPE::RadiusType());
|
|
|
|
}
|
2012-10-15 11:17:48 +02:00
|
|
|
|
2013-09-24 15:55:23 +02:00
|
|
|
void pop_back();
|
2012-10-15 11:17:48 +02:00
|
|
|
|
2014-06-19 10:31:51 +02:00
|
|
|
void resize(const unsigned int & _size)
|
|
|
|
{
|
|
|
|
const unsigned int oldsize = BaseType::size();
|
|
|
|
BaseType::resize(_size);
|
|
|
|
if(oldsize<_size){
|
|
|
|
ThisTypeIterator firstnew = BaseType::begin();
|
|
|
|
advance(firstnew,oldsize);
|
|
|
|
_updateOVP(firstnew,(*this).end());
|
|
|
|
}
|
|
|
|
if (ColorEnabled) CV.resize(_size);
|
|
|
|
if (QualityEnabled) QV.resize(_size,0);
|
|
|
|
if (MarkEnabled) MV.resize(_size);
|
|
|
|
if (NormalEnabled) NV.resize(_size);
|
|
|
|
if (TexCoordEnabled) TV.resize(_size);
|
|
|
|
if (VFAdjacencyEnabled) AV.resize(_size);
|
|
|
|
if (CurvatureEnabled) CuV.resize(_size);
|
|
|
|
if (CurvatureDirEnabled) CuDV.resize(_size);
|
|
|
|
if (RadiusEnabled) RadiusV.resize(_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void reserve(const unsigned int & _size)
|
|
|
|
{
|
|
|
|
BaseType::reserve(_size);
|
|
|
|
if (ColorEnabled) CV.reserve(_size);
|
|
|
|
if (QualityEnabled) QV.reserve(_size);
|
|
|
|
if (MarkEnabled) MV.reserve(_size);
|
|
|
|
if (NormalEnabled) NV.reserve(_size);
|
|
|
|
if (TexCoordEnabled) TV.reserve(_size);
|
|
|
|
if (VFAdjacencyEnabled) AV.reserve(_size);
|
|
|
|
if (CurvatureEnabled) CuV.reserve(_size);
|
|
|
|
if (CurvatureDirEnabled) CuDV.reserve(_size);
|
|
|
|
if (RadiusEnabled) RadiusV.reserve(_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend)
|
|
|
|
{
|
|
|
|
ThisTypeIterator vi;
|
|
|
|
for(vi=lbegin;vi!=lend;++vi)
|
|
|
|
(*vi)._ovp=this;
|
|
|
|
}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
|
|
|
////////////////////////////////////////
|
|
|
|
// Enabling Eunctions
|
|
|
|
|
|
|
|
bool IsQualityEnabled() const {return QualityEnabled;}
|
|
|
|
void EnableQuality() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasQualityOcf());
|
|
|
|
QualityEnabled=true;
|
|
|
|
QV.resize((*this).size(),0);
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
void DisableQuality() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasQualityOcf());
|
|
|
|
QualityEnabled=false;
|
|
|
|
QV.clear();
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsColorEnabled() const {return ColorEnabled;}
|
|
|
|
void EnableColor() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasColorOcf());
|
|
|
|
ColorEnabled=true;
|
|
|
|
CV.resize((*this).size());
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
void DisableColor() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasColorOcf());
|
|
|
|
ColorEnabled=false;
|
|
|
|
CV.clear();
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsMarkEnabled() const {return MarkEnabled;}
|
|
|
|
void EnableMark() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasMarkOcf());
|
|
|
|
MarkEnabled=true;
|
|
|
|
MV.resize((*this).size(),0);
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
void DisableMark() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasMarkOcf());
|
|
|
|
MarkEnabled=false;
|
|
|
|
MV.clear();
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsNormalEnabled() const {return NormalEnabled;}
|
|
|
|
void EnableNormal() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasNormalOcf());
|
|
|
|
NormalEnabled=true;
|
|
|
|
NV.resize((*this).size());
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
void DisableNormal() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasNormalOcf());
|
|
|
|
NormalEnabled=false;
|
|
|
|
NV.clear();
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
|
2009-10-29 18:16:41 +01:00
|
|
|
bool IsVFAdjacencyEnabled() const {return VFAdjacencyEnabled;}
|
2008-12-19 11:31:56 +01:00
|
|
|
void EnableVFAdjacency() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasVFAdjacencyOcf());
|
|
|
|
VFAdjacencyEnabled=true;
|
|
|
|
VFAdjType zero; zero._fp=0; zero._zp=-1;
|
|
|
|
AV.resize((*this).size(),zero);
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
void DisableVFAdjacency() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasVFAdjacencyOcf());
|
|
|
|
VFAdjacencyEnabled=false;
|
|
|
|
AV.clear();
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsCurvatureEnabled() const {return CurvatureEnabled;}
|
|
|
|
void EnableCurvature() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasCurvatureOcf());
|
|
|
|
CurvatureEnabled=true;
|
|
|
|
CuV.resize((*this).size());
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
void DisableCurvature() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasCurvatureOcf());
|
|
|
|
CurvatureEnabled=false;
|
|
|
|
CuV.clear();
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsCurvatureDirEnabled() const {return CurvatureDirEnabled;}
|
|
|
|
void EnableCurvatureDir() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasCurvatureDirOcf());
|
|
|
|
CurvatureDirEnabled=true;
|
|
|
|
CuDV.resize((*this).size());
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
void DisableCurvatureDir() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasCurvatureDirOcf());
|
|
|
|
CurvatureDirEnabled=false;
|
|
|
|
CuDV.clear();
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool IsRadiusEnabled() const {return RadiusEnabled;}
|
|
|
|
void EnableRadius() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasRadiusOcf());
|
|
|
|
RadiusEnabled=true;
|
|
|
|
RadiusV.resize((*this).size());
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
void DisableRadius() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasRadiusOcf());
|
|
|
|
RadiusEnabled=false;
|
|
|
|
RadiusV.clear();
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
|
2009-06-23 22:45:44 +02:00
|
|
|
|
|
|
|
bool IsTexCoordEnabled() const {return TexCoordEnabled;}
|
|
|
|
void EnableTexCoord() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasTexCoordOcf());
|
|
|
|
TexCoordEnabled=true;
|
|
|
|
TV.resize((*this).size());
|
2009-06-23 22:45:44 +02:00
|
|
|
}
|
|
|
|
void DisableTexCoord() {
|
2014-06-19 10:31:51 +02:00
|
|
|
assert(VALUE_TYPE::HasTexCoordOcf());
|
|
|
|
TexCoordEnabled=false;
|
|
|
|
TV.clear();
|
2009-06-23 22:45:44 +02:00
|
|
|
}
|
2012-11-15 20:04:08 +01:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
struct VFAdjType {
|
2014-06-19 10:31:51 +02:00
|
|
|
typename VALUE_TYPE::FacePointer _fp ;
|
|
|
|
int _zp ;
|
|
|
|
};
|
2008-12-19 11:31:56 +01:00
|
|
|
|
|
|
|
public:
|
2010-04-20 02:57:25 +02:00
|
|
|
std::vector<typename VALUE_TYPE::ColorType> CV;
|
|
|
|
std::vector<typename VALUE_TYPE::CurvatureType> CuV;
|
2012-10-15 11:17:48 +02:00
|
|
|
std::vector<typename VALUE_TYPE::CurvatureDirType> CuDV;
|
2010-04-20 02:57:25 +02:00
|
|
|
std::vector<int> MV;
|
|
|
|
std::vector<typename VALUE_TYPE::NormalType> NV;
|
|
|
|
std::vector<typename VALUE_TYPE::QualityType> QV;
|
2012-10-15 11:17:48 +02:00
|
|
|
std::vector<typename VALUE_TYPE::RadiusType> RadiusV;
|
|
|
|
std::vector<typename VALUE_TYPE::TexCoordType> TV;
|
|
|
|
std::vector<struct VFAdjType> AV;
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2010-04-20 02:57:25 +02:00
|
|
|
bool ColorEnabled;
|
2012-10-15 11:17:48 +02:00
|
|
|
bool CurvatureEnabled;
|
|
|
|
bool CurvatureDirEnabled;
|
2010-04-20 02:57:25 +02:00
|
|
|
bool MarkEnabled;
|
|
|
|
bool NormalEnabled;
|
|
|
|
bool QualityEnabled;
|
2012-10-15 11:17:48 +02:00
|
|
|
bool RadiusEnabled;
|
2010-04-20 02:57:25 +02:00
|
|
|
bool TexCoordEnabled;
|
|
|
|
bool VFAdjacencyEnabled;
|
2008-12-19 11:31:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//template<> void EnableAttribute<typename VALUE_TYPE::NormalType>(){ NormalEnabled=true;}
|
|
|
|
|
|
|
|
/*------------------------- COORD -----------------------------------------*/
|
|
|
|
/*----------------------------- VFADJ ------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
template <class T> class VFAdjOcf: public T {
|
|
|
|
public:
|
2014-06-19 10:31:51 +02:00
|
|
|
typename T::FacePointer &VFp() {
|
|
|
|
assert((*this).Base().VFAdjacencyEnabled);
|
|
|
|
return (*this).Base().AV[(*this).Index()]._fp;
|
|
|
|
}
|
|
|
|
typename T::FacePointer cVFp() const {
|
|
|
|
if(! (*this).Base().VFAdjacencyEnabled ) return 0;
|
|
|
|
else return (*this).Base().AV[(*this).Index()]._fp;
|
|
|
|
}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2012-11-15 20:04:08 +01:00
|
|
|
int &VFi() {
|
2010-02-22 18:37:51 +01:00
|
|
|
assert((*this).Base().VFAdjacencyEnabled);
|
|
|
|
return (*this).Base().AV[(*this).Index()]._zp;
|
|
|
|
}
|
|
|
|
int cVFi() const {
|
|
|
|
if(! (*this).Base().VFAdjacencyEnabled ) return -1;
|
|
|
|
return (*this).Base().AV[(*this).Index()]._zp;
|
|
|
|
}
|
2012-12-17 23:54:48 +01:00
|
|
|
template <class RightVertexType>
|
|
|
|
void ImportData(const RightVertexType & rightV)
|
2013-09-24 15:55:23 +02:00
|
|
|
{
|
|
|
|
T::ImportData(rightV);
|
|
|
|
}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2010-03-03 17:01:39 +01:00
|
|
|
static bool HasVFAdjacency() { return true; }
|
|
|
|
static bool HasVFAdjacencyOcf() { return true; }
|
2013-02-06 12:22:11 +01:00
|
|
|
bool IsVFAdjacencyEnabled(const typename T::VertexType *vp) {return vp->Base().VFAdjacencyEnabled;}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2012-07-02 16:38:10 +02:00
|
|
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdjOcf"));T::Name(name);}
|
2008-12-19 11:31:56 +01:00
|
|
|
private:
|
|
|
|
};
|
|
|
|
|
|
|
|
/*------------------------- Normal -----------------------------------------*/
|
|
|
|
|
|
|
|
template <class A, class T> class NormalOcf: public T {
|
|
|
|
public:
|
2012-11-15 20:04:08 +01:00
|
|
|
typedef A NormalType;
|
2013-02-06 12:22:11 +01:00
|
|
|
inline bool IsNormalEnabled( ) const { return this->Base().IsNormalEnabled(); }
|
2012-11-15 20:04:08 +01:00
|
|
|
static bool HasNormal() { return true; }
|
|
|
|
static bool HasNormalOcf() { return true; }
|
|
|
|
|
2012-11-27 13:16:16 +01:00
|
|
|
const NormalType &N() const { assert((*this).Base().NormalEnabled); return (*this).Base().NV[(*this).Index()]; }
|
|
|
|
NormalType &N() { assert((*this).Base().NormalEnabled); return (*this).Base().NV[(*this).Index()]; }
|
|
|
|
NormalType cN() const { assert((*this).Base().NormalEnabled); return (*this).Base().NV[(*this).Index()]; }
|
2012-11-15 20:04:08 +01:00
|
|
|
|
2012-12-17 23:54:48 +01:00
|
|
|
template <class RightVertexType>
|
|
|
|
void ImportData(const RightVertexType & rightV){
|
|
|
|
if((*this).IsNormalEnabled() && rightV.IsNormalEnabled() )
|
|
|
|
N().Import(rightV.cN());
|
|
|
|
T::ImportData(rightV);}
|
2008-12-19 11:31:56 +01:00
|
|
|
};
|
|
|
|
|
2012-07-02 16:38:10 +02:00
|
|
|
template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3sOcf"));T::Name(name);}};
|
|
|
|
template <class T> class Normal3fOcf: public NormalOcf<vcg::Point3f, T> {public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3fOcf"));T::Name(name);}};
|
|
|
|
template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3dOcf"));T::Name(name);}};
|
2008-12-19 11:31:56 +01:00
|
|
|
|
|
|
|
///*-------------------------- COLOR ----------------------------------*/
|
|
|
|
|
|
|
|
template <class A, class T> class ColorOcf: public T {
|
|
|
|
public:
|
2012-11-15 20:04:08 +01:00
|
|
|
typedef A ColorType;
|
2012-11-27 13:16:16 +01:00
|
|
|
const ColorType &C() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
|
|
|
|
ColorType &C() { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
|
|
|
|
ColorType cC() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
|
2012-12-17 23:54:48 +01:00
|
|
|
template <class RightVertexType>
|
|
|
|
void ImportData(const RightVertexType & rightV)
|
2012-11-15 20:04:08 +01:00
|
|
|
{
|
2012-12-17 23:54:48 +01:00
|
|
|
if((*this).IsColorEnabled() && rightV.IsColorEnabled() )
|
|
|
|
C() = rightV.cC();
|
|
|
|
T::ImportData(rightV);
|
2012-11-15 20:04:08 +01:00
|
|
|
}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2013-02-06 12:22:11 +01:00
|
|
|
inline bool IsColorEnabled() const { return this->Base().IsColorEnabled();}
|
2012-11-15 20:04:08 +01:00
|
|
|
static bool HasColor() { return true; }
|
|
|
|
static bool HasColorOcf() { assert(!T::HasColorOcf()); return true; }
|
2008-12-19 11:31:56 +01:00
|
|
|
};
|
|
|
|
|
2012-07-02 16:38:10 +02:00
|
|
|
template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {
|
2012-08-22 20:36:59 +02:00
|
|
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4bOcf"));T::Name(name);}
|
2012-07-02 16:38:10 +02:00
|
|
|
};
|
2008-12-19 11:31:56 +01:00
|
|
|
|
|
|
|
///*-------------------------- QUALITY ----------------------------------*/
|
|
|
|
|
|
|
|
template <class A, class T> class QualityOcf: public T {
|
|
|
|
public:
|
2012-11-15 20:04:08 +01:00
|
|
|
typedef A QualityType;
|
2012-11-27 13:16:16 +01:00
|
|
|
const QualityType &Q() const { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
|
|
|
|
QualityType &Q() { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
|
|
|
|
QualityType cQ() const { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
|
2012-12-17 23:54:48 +01:00
|
|
|
template <class RightVertexType>
|
|
|
|
void ImportData(const RightVertexType & rightV)
|
2012-11-15 20:04:08 +01:00
|
|
|
{
|
2012-12-21 16:33:18 +01:00
|
|
|
if((*this).IsQualityEnabled() && rightV.IsQualityEnabled() ) // copy the data only if they are enabled in both vertices
|
2012-12-17 23:54:48 +01:00
|
|
|
Q() = rightV.cQ();
|
|
|
|
T::ImportData(rightV);
|
2012-11-15 20:04:08 +01:00
|
|
|
}
|
2013-02-06 12:22:11 +01:00
|
|
|
inline bool IsQualityEnabled( ) const { return this->Base().IsQualityEnabled(); }
|
2012-11-15 20:04:08 +01:00
|
|
|
static bool HasQuality() { return true; }
|
|
|
|
static bool HasQualityOcf() { assert(!T::HasQualityOcf()); return true; }
|
2008-12-19 11:31:56 +01:00
|
|
|
};
|
|
|
|
|
2012-07-02 16:38:10 +02:00
|
|
|
template <class T> class QualityfOcf: public QualityOcf<float, T> {
|
|
|
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("QualityfOcf"));T::Name(name);}
|
|
|
|
};
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2009-06-23 22:45:44 +02:00
|
|
|
|
|
|
|
///*-------------------------- TEXTURE ----------------------------------*/
|
|
|
|
|
|
|
|
template <class A, class TT> class TexCoordOcf: public TT {
|
|
|
|
public:
|
|
|
|
typedef A TexCoordType;
|
2012-11-27 13:16:16 +01:00
|
|
|
const TexCoordType &T() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
|
|
|
|
TexCoordType &T() { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
|
|
|
|
TexCoordType cT() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
|
2012-12-17 23:54:48 +01:00
|
|
|
template < class RightVertexType>
|
|
|
|
void ImportData(const RightVertexType & rightV)
|
2012-11-15 20:04:08 +01:00
|
|
|
{
|
2012-12-17 23:54:48 +01:00
|
|
|
if((*this).IsTexCoordEnabled() && rightV.IsTexCoordEnabled()) // copy the data only if they are enabled in both vertices
|
|
|
|
T() = rightV.cT();
|
|
|
|
TT::ImportData(rightV);
|
2012-11-15 20:04:08 +01:00
|
|
|
}
|
2013-02-06 12:22:11 +01:00
|
|
|
inline bool IsTexCoordEnabled( ) const { return this->Base().IsTexCoordEnabled(); }
|
2012-11-15 20:04:08 +01:00
|
|
|
static bool HasTexCoord() { return true; }
|
|
|
|
static bool HasTexCoordOcf() { assert(!TT::HasTexCoordOcf()); return true; }
|
2009-06-23 22:45:44 +02:00
|
|
|
};
|
|
|
|
|
2012-07-02 16:38:10 +02:00
|
|
|
template <class T> class TexCoordfOcf: public TexCoordOcf<TexCoord2<float,1>, T> {
|
2012-07-03 13:12:21 +02:00
|
|
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoordfOcf"));T::Name(name);}
|
2012-07-02 16:38:10 +02:00
|
|
|
};
|
2009-06-23 22:45:44 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
///*-------------------------- MARK ----------------------------------*/
|
|
|
|
|
|
|
|
template <class T> class MarkOcf: public T {
|
|
|
|
public:
|
2012-11-15 20:04:08 +01:00
|
|
|
typedef int MarkType;
|
2012-11-27 13:16:16 +01:00
|
|
|
inline const int &IMark() const { assert((*this).Base().MarkEnabled); return (*this).Base().MV[(*this).Index()]; }
|
|
|
|
inline int &IMark() { assert((*this).Base().MarkEnabled); return (*this).Base().MV[(*this).Index()]; }
|
|
|
|
inline int cIMark() const { assert((*this).Base().MarkEnabled); return (*this).Base().MV[(*this).Index()]; }
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2012-12-17 23:54:48 +01:00
|
|
|
template <class RightVertexType>
|
|
|
|
void ImportData(const RightVertexType & rightV)
|
2012-11-15 20:04:08 +01:00
|
|
|
{
|
2012-12-17 23:54:48 +01:00
|
|
|
if((*this).IsMarkEnabled() && rightV.IsMarkEnabled()) // copy the data only if they are enabled in both vertices
|
|
|
|
IMark() = rightV.cIMark();
|
|
|
|
T::ImportData(rightV);
|
2012-11-15 20:04:08 +01:00
|
|
|
}
|
2013-02-06 12:22:11 +01:00
|
|
|
inline bool IsMarkEnabled( ) const { return this->Base().IsMarkEnabled(); }
|
2012-11-15 20:04:08 +01:00
|
|
|
static bool HasMark() { return true; }
|
|
|
|
static bool HasMarkOcf() { return true; }
|
|
|
|
inline void InitIMark() { IMark() = 0; }
|
|
|
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("IMark"));T::Name(name);}
|
2012-07-02 16:38:10 +02:00
|
|
|
|
2008-12-19 11:31:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///*-------------------------- CURVATURE ----------------------------------*/
|
|
|
|
|
|
|
|
template <class A, class TT> class CurvatureOcf: public TT {
|
|
|
|
public:
|
2012-11-15 20:04:08 +01:00
|
|
|
typedef Point2<A> CurvatureType;
|
2014-06-19 10:31:51 +02:00
|
|
|
typedef typename CurvatureType::ScalarType CurScalarType;
|
2010-03-03 17:01:39 +01:00
|
|
|
|
2014-06-19 10:31:51 +02:00
|
|
|
CurScalarType &Kh(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
|
|
|
|
CurScalarType &Kg(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
|
|
|
|
CurScalarType cKh() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
|
|
|
|
CurScalarType cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
|
2012-07-02 16:38:10 +02:00
|
|
|
|
2012-12-17 23:54:48 +01:00
|
|
|
template <class RightVertexType>
|
|
|
|
void ImportData(const RightVertexType & rightV){
|
|
|
|
if((*this).IsCurvatureEnabled() && rightV.IsCurvatureEnabled())
|
2012-11-15 20:04:08 +01:00
|
|
|
{
|
2012-12-17 23:54:48 +01:00
|
|
|
(*this).Base().CuV[(*this).Index()][0] = rightV.cKh();
|
|
|
|
(*this).Base().CuV[(*this).Index()][1] = rightV.cKg();
|
2012-11-15 20:04:08 +01:00
|
|
|
}
|
2012-12-17 23:54:48 +01:00
|
|
|
TT::ImportData(rightV);
|
2012-11-15 20:04:08 +01:00
|
|
|
}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2013-02-06 12:22:11 +01:00
|
|
|
inline bool IsCurvatureEnabled( ) const { return this->Base().IsCurvatureDirEnabled(); }
|
2012-11-15 20:04:08 +01:00
|
|
|
static bool HasCurvature() { return true; }
|
|
|
|
static bool HasCurvatureOcf() { return true; }
|
2008-12-19 11:31:56 +01:00
|
|
|
};
|
|
|
|
|
2012-07-03 13:12:21 +02:00
|
|
|
template <class T> class CurvaturefOcf: public CurvatureOcf<float, T> {public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturefOcf"));T::Name(name);} };
|
|
|
|
template <class T> class CurvaturedOcf: public CurvatureOcf<double, T> {public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturedOcf"));T::Name(name);} };
|
2008-12-19 11:31:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
///*-------------------------- CURVATURE DIR ----------------------------------*/
|
|
|
|
|
|
|
|
template <class S>
|
|
|
|
struct CurvatureDirTypeOcf{
|
2014-06-19 10:31:51 +02:00
|
|
|
typedef Point3<S> CurVecType;
|
|
|
|
typedef S CurScalarType;
|
|
|
|
CurvatureDirTypeOcf () {}
|
|
|
|
CurVecType max_dir,min_dir;
|
|
|
|
CurScalarType k1,k2;
|
2008-12-19 11:31:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
template <class A, class TT> class CurvatureDirOcf: public TT {
|
|
|
|
public:
|
2012-11-15 20:04:08 +01:00
|
|
|
typedef A CurvatureDirType;
|
2014-06-19 10:31:51 +02:00
|
|
|
typedef typename CurvatureDirType::CurVecType CurVecType;
|
|
|
|
typedef typename CurvatureDirType::CurScalarType CurScalarType;
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2014-06-19 10:31:51 +02:00
|
|
|
CurVecType &PD1() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;}
|
|
|
|
CurVecType &PD2() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;}
|
|
|
|
CurVecType cPD1() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;}
|
|
|
|
CurVecType cPD2() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2014-06-19 10:31:51 +02:00
|
|
|
CurScalarType &K1() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;}
|
|
|
|
CurScalarType &K2() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
|
|
|
|
CurScalarType cK1() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;}
|
|
|
|
CurScalarType cK2() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2012-12-17 23:54:48 +01:00
|
|
|
template <class RightVertexType>
|
|
|
|
void ImportData(const RightVertexType & rightV){
|
|
|
|
if((*this).IsCurvatureDirEnabled() && rightV.IsCurvatureDirEnabled())
|
2012-11-15 20:04:08 +01:00
|
|
|
{
|
2014-07-12 23:09:27 +02:00
|
|
|
(*this).PD1().Import(rightV.cPD1());
|
|
|
|
(*this).PD2().Import(rightV.cPD2());
|
|
|
|
(*this).K1()=rightV.cK1();
|
|
|
|
(*this).K2()=rightV.cK2();
|
2012-11-15 20:04:08 +01:00
|
|
|
}
|
2012-12-17 23:54:48 +01:00
|
|
|
TT::ImportData(rightV);
|
2010-03-03 17:01:39 +01:00
|
|
|
}
|
2013-02-06 12:22:11 +01:00
|
|
|
|
|
|
|
inline bool IsCurvatureDirEnabled( ) const { return this->Base().IsCurvatureDirEnabled(); }
|
2010-03-03 17:01:39 +01:00
|
|
|
static bool HasCurvatureDir() { return true; }
|
|
|
|
static bool HasCurvatureDirOcf() { return true; }
|
|
|
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirOcf"));TT::Name(name);}
|
2012-11-15 20:04:08 +01:00
|
|
|
};
|
2008-12-19 11:31:56 +01:00
|
|
|
|
|
|
|
template <class T> class CurvatureDirfOcf: public CurvatureDirOcf<CurvatureDirTypeOcf<float>, T> {
|
|
|
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirfOcf"));T::Name(name);}
|
|
|
|
};
|
|
|
|
template <class T> class CurvatureDirdOcf: public CurvatureDirOcf<CurvatureDirTypeOcf<double>, T> {
|
|
|
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirdOcf"));T::Name(name);}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
///*-------------------------- RADIUS ----------------------------------*/
|
|
|
|
|
|
|
|
template <class A, class TT> class RadiusOcf: public TT {
|
|
|
|
public:
|
2012-11-15 20:04:08 +01:00
|
|
|
typedef A RadiusType;
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2012-11-27 13:16:16 +01:00
|
|
|
const RadiusType &R() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
|
|
|
|
RadiusType &R() { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
|
|
|
|
RadiusType cR() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2012-12-17 23:54:48 +01:00
|
|
|
template <class RightVertexType>
|
|
|
|
void ImportData(const RightVertexType & rightV)
|
2012-11-15 20:04:08 +01:00
|
|
|
{
|
2012-12-17 23:54:48 +01:00
|
|
|
if ((*this).IsRadiusEnabled() && rightV.IsRadiusEnabled())
|
|
|
|
(*this).Base().RadiusV[(*this).Index()] = rightV.cR();
|
|
|
|
TT::ImportData(rightV);
|
2012-11-15 20:04:08 +01:00
|
|
|
}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2013-02-06 12:22:11 +01:00
|
|
|
inline bool IsRadiusEnabled( ) const { return this->Base().IsRadiusEnabled(); }
|
2012-11-15 20:04:08 +01:00
|
|
|
static bool HasRadius() { return true; }
|
|
|
|
static bool HasRadiusOcf() { return true; }
|
|
|
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusOcf")); TT::Name(name);}
|
2008-12-19 11:31:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
template <class T> class RadiusfOcf: public RadiusOcf<float, T> {};
|
|
|
|
template <class T> class RadiusdOcf: public RadiusOcf<double, T> {};
|
|
|
|
|
|
|
|
|
|
|
|
///*-------------------------- InfoOpt ----------------------------------*/
|
|
|
|
|
|
|
|
template < class T> class InfoOcf: public T {
|
|
|
|
public:
|
2014-06-19 10:31:51 +02:00
|
|
|
// You should never ever try to copy a vertex that has OCF stuff.
|
|
|
|
// use ImportData function.
|
|
|
|
inline InfoOcf &operator=(const InfoOcf & /*other*/) {
|
|
|
|
assert(0); return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
vector_ocf<typename T::VertexType> &Base() const { return *_ovp;}
|
|
|
|
|
|
|
|
inline int Index() const {
|
|
|
|
typename T::VertexType const *tp=static_cast<typename T::VertexType const*>(this);
|
|
|
|
int tt2=tp- &*(_ovp->begin());
|
|
|
|
return tt2;
|
|
|
|
}
|
2008-12-19 11:31:56 +01:00
|
|
|
public:
|
2014-06-19 10:31:51 +02:00
|
|
|
vector_ocf<typename T::VertexType> *_ovp;
|
|
|
|
|
|
|
|
static bool HasColorOcf() { return false; }
|
|
|
|
static bool HasCurvatureOcf() { return false; }
|
|
|
|
static bool HasCurvatureDirOcf() { return false; }
|
|
|
|
static bool HasNormalOcf() { return false; }
|
|
|
|
static bool HasMarkOcf() { return false; }
|
|
|
|
static bool HasQualityOcf() { return false; }
|
|
|
|
static bool HasRadiusOcf() { return false; }
|
|
|
|
static bool HasTexCoordOcf() { return false; }
|
|
|
|
static bool HasVFAdjacencyOcf() { return false; }
|
2008-12-19 11:31:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
} // end namespace vert
|
|
|
|
|
|
|
|
|
|
|
|
namespace tri
|
|
|
|
{
|
Corrected a significant bug in the reflection types for ocf components.
Changed the basic reflection mechanism: Instead of having a function templates over all the four containers now we template over Trimesh and we rely on a second function templated on face/vert that wants a vector<face> ; this second function only is eventually overloaded by another function that needs a vector_ocf of faces.
That is Before we had:
- in complex.h
template < class CType0, class CType1, class CType2 , class CType3>
bool HasPerFaceVFAdjacency (const TriMesh < CType0, CType1, CType2, CType3> & /*m*/) {return TriMesh < CType0 , CType1, CType2, CType3>::FaceContainer::value_type::HasVFAdjacency();}
- in the component_ocf.h
template < class VertContainerType, class FaceType, class Container1, class Container2 >
bool HasPerFaceVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
{
if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
else return FaceType::FaceType::HasVFAdjacency();
}
While now we have:
- in complex.h
template < class FaceType > bool FaceVectorHasPerFaceVFAdjacency (const std::vector<FaceType > &) { return FaceType::HasVFAdjacency(); }
template < class TriMeshType> bool HasPerFaceVFAdjacency (const TriMeshType &m) { return tri::FaceVectorHasPerFaceVFAdjacency (m.vert); }
- and in component_ocf.h
template < class FaceType >
bool FaceVectorHasPerFaceVFAdjacency(const face::vector_ocf<FaceType> &fv)
{
if(FaceType::HasVFAdjacencyOcf()) return fv.IsVFAdjacencyEnabled();
else return FaceType::HasVFAdjacency();
}
2012-03-31 03:16:58 +02:00
|
|
|
template < class VertexType >
|
2012-11-14 13:37:18 +01:00
|
|
|
bool VertexVectorHasVFAdjacency(const vertex::vector_ocf<VertexType> &fv)
|
Corrected a significant bug in the reflection types for ocf components.
Changed the basic reflection mechanism: Instead of having a function templates over all the four containers now we template over Trimesh and we rely on a second function templated on face/vert that wants a vector<face> ; this second function only is eventually overloaded by another function that needs a vector_ocf of faces.
That is Before we had:
- in complex.h
template < class CType0, class CType1, class CType2 , class CType3>
bool HasPerFaceVFAdjacency (const TriMesh < CType0, CType1, CType2, CType3> & /*m*/) {return TriMesh < CType0 , CType1, CType2, CType3>::FaceContainer::value_type::HasVFAdjacency();}
- in the component_ocf.h
template < class VertContainerType, class FaceType, class Container1, class Container2 >
bool HasPerFaceVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
{
if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
else return FaceType::FaceType::HasVFAdjacency();
}
While now we have:
- in complex.h
template < class FaceType > bool FaceVectorHasPerFaceVFAdjacency (const std::vector<FaceType > &) { return FaceType::HasVFAdjacency(); }
template < class TriMeshType> bool HasPerFaceVFAdjacency (const TriMeshType &m) { return tri::FaceVectorHasPerFaceVFAdjacency (m.vert); }
- and in component_ocf.h
template < class FaceType >
bool FaceVectorHasPerFaceVFAdjacency(const face::vector_ocf<FaceType> &fv)
{
if(FaceType::HasVFAdjacencyOcf()) return fv.IsVFAdjacencyEnabled();
else return FaceType::HasVFAdjacency();
}
2012-03-31 03:16:58 +02:00
|
|
|
{
|
|
|
|
if(VertexType::HasVFAdjacencyOcf()) return fv.IsVFAdjacencyEnabled();
|
|
|
|
else return VertexType::HasVFAdjacency();
|
|
|
|
}
|
|
|
|
template < class VertexType >
|
|
|
|
bool VertexVectorHasPerVertexRadius(const vertex::vector_ocf<VertexType> &fv)
|
|
|
|
{
|
2014-06-19 10:31:51 +02:00
|
|
|
if(VertexType::HasRadiusOcf()) return fv.IsRadiusEnabled();
|
|
|
|
else return VertexType::HasRadius();
|
Corrected a significant bug in the reflection types for ocf components.
Changed the basic reflection mechanism: Instead of having a function templates over all the four containers now we template over Trimesh and we rely on a second function templated on face/vert that wants a vector<face> ; this second function only is eventually overloaded by another function that needs a vector_ocf of faces.
That is Before we had:
- in complex.h
template < class CType0, class CType1, class CType2 , class CType3>
bool HasPerFaceVFAdjacency (const TriMesh < CType0, CType1, CType2, CType3> & /*m*/) {return TriMesh < CType0 , CType1, CType2, CType3>::FaceContainer::value_type::HasVFAdjacency();}
- in the component_ocf.h
template < class VertContainerType, class FaceType, class Container1, class Container2 >
bool HasPerFaceVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
{
if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
else return FaceType::FaceType::HasVFAdjacency();
}
While now we have:
- in complex.h
template < class FaceType > bool FaceVectorHasPerFaceVFAdjacency (const std::vector<FaceType > &) { return FaceType::HasVFAdjacency(); }
template < class TriMeshType> bool HasPerFaceVFAdjacency (const TriMeshType &m) { return tri::FaceVectorHasPerFaceVFAdjacency (m.vert); }
- and in component_ocf.h
template < class FaceType >
bool FaceVectorHasPerFaceVFAdjacency(const face::vector_ocf<FaceType> &fv)
{
if(FaceType::HasVFAdjacencyOcf()) return fv.IsVFAdjacencyEnabled();
else return FaceType::HasVFAdjacency();
}
2012-03-31 03:16:58 +02:00
|
|
|
}
|
|
|
|
template < class VertexType >
|
|
|
|
bool VertexVectorHasPerVertexQuality(const vertex::vector_ocf<VertexType> &fv)
|
|
|
|
{
|
2014-06-19 10:31:51 +02:00
|
|
|
if(VertexType::HasQualityOcf()) return fv.IsQualityEnabled();
|
|
|
|
else return VertexType::HasQuality();
|
Corrected a significant bug in the reflection types for ocf components.
Changed the basic reflection mechanism: Instead of having a function templates over all the four containers now we template over Trimesh and we rely on a second function templated on face/vert that wants a vector<face> ; this second function only is eventually overloaded by another function that needs a vector_ocf of faces.
That is Before we had:
- in complex.h
template < class CType0, class CType1, class CType2 , class CType3>
bool HasPerFaceVFAdjacency (const TriMesh < CType0, CType1, CType2, CType3> & /*m*/) {return TriMesh < CType0 , CType1, CType2, CType3>::FaceContainer::value_type::HasVFAdjacency();}
- in the component_ocf.h
template < class VertContainerType, class FaceType, class Container1, class Container2 >
bool HasPerFaceVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
{
if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
else return FaceType::FaceType::HasVFAdjacency();
}
While now we have:
- in complex.h
template < class FaceType > bool FaceVectorHasPerFaceVFAdjacency (const std::vector<FaceType > &) { return FaceType::HasVFAdjacency(); }
template < class TriMeshType> bool HasPerFaceVFAdjacency (const TriMeshType &m) { return tri::FaceVectorHasPerFaceVFAdjacency (m.vert); }
- and in component_ocf.h
template < class FaceType >
bool FaceVectorHasPerFaceVFAdjacency(const face::vector_ocf<FaceType> &fv)
{
if(FaceType::HasVFAdjacencyOcf()) return fv.IsVFAdjacencyEnabled();
else return FaceType::HasVFAdjacency();
}
2012-03-31 03:16:58 +02:00
|
|
|
}
|
|
|
|
template < class VertexType >
|
|
|
|
bool VertexVectorHasPerVertexNormal(const vertex::vector_ocf<VertexType> &fv)
|
|
|
|
{
|
2014-06-19 10:31:51 +02:00
|
|
|
if(VertexType::HasNormalOcf()) return fv.IsNormalEnabled();
|
|
|
|
else return VertexType::HasNormal();
|
Corrected a significant bug in the reflection types for ocf components.
Changed the basic reflection mechanism: Instead of having a function templates over all the four containers now we template over Trimesh and we rely on a second function templated on face/vert that wants a vector<face> ; this second function only is eventually overloaded by another function that needs a vector_ocf of faces.
That is Before we had:
- in complex.h
template < class CType0, class CType1, class CType2 , class CType3>
bool HasPerFaceVFAdjacency (const TriMesh < CType0, CType1, CType2, CType3> & /*m*/) {return TriMesh < CType0 , CType1, CType2, CType3>::FaceContainer::value_type::HasVFAdjacency();}
- in the component_ocf.h
template < class VertContainerType, class FaceType, class Container1, class Container2 >
bool HasPerFaceVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
{
if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
else return FaceType::FaceType::HasVFAdjacency();
}
While now we have:
- in complex.h
template < class FaceType > bool FaceVectorHasPerFaceVFAdjacency (const std::vector<FaceType > &) { return FaceType::HasVFAdjacency(); }
template < class TriMeshType> bool HasPerFaceVFAdjacency (const TriMeshType &m) { return tri::FaceVectorHasPerFaceVFAdjacency (m.vert); }
- and in component_ocf.h
template < class FaceType >
bool FaceVectorHasPerFaceVFAdjacency(const face::vector_ocf<FaceType> &fv)
{
if(FaceType::HasVFAdjacencyOcf()) return fv.IsVFAdjacencyEnabled();
else return FaceType::HasVFAdjacency();
}
2012-03-31 03:16:58 +02:00
|
|
|
}
|
|
|
|
template < class VertexType >
|
|
|
|
bool VertexVectorHasPerVertexColor(const vertex::vector_ocf<VertexType> &fv)
|
|
|
|
{
|
2014-06-19 10:31:51 +02:00
|
|
|
if(VertexType::HasColorOcf()) return fv.IsColorEnabled();
|
|
|
|
else return VertexType::HasColor();
|
Corrected a significant bug in the reflection types for ocf components.
Changed the basic reflection mechanism: Instead of having a function templates over all the four containers now we template over Trimesh and we rely on a second function templated on face/vert that wants a vector<face> ; this second function only is eventually overloaded by another function that needs a vector_ocf of faces.
That is Before we had:
- in complex.h
template < class CType0, class CType1, class CType2 , class CType3>
bool HasPerFaceVFAdjacency (const TriMesh < CType0, CType1, CType2, CType3> & /*m*/) {return TriMesh < CType0 , CType1, CType2, CType3>::FaceContainer::value_type::HasVFAdjacency();}
- in the component_ocf.h
template < class VertContainerType, class FaceType, class Container1, class Container2 >
bool HasPerFaceVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
{
if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
else return FaceType::FaceType::HasVFAdjacency();
}
While now we have:
- in complex.h
template < class FaceType > bool FaceVectorHasPerFaceVFAdjacency (const std::vector<FaceType > &) { return FaceType::HasVFAdjacency(); }
template < class TriMeshType> bool HasPerFaceVFAdjacency (const TriMeshType &m) { return tri::FaceVectorHasPerFaceVFAdjacency (m.vert); }
- and in component_ocf.h
template < class FaceType >
bool FaceVectorHasPerFaceVFAdjacency(const face::vector_ocf<FaceType> &fv)
{
if(FaceType::HasVFAdjacencyOcf()) return fv.IsVFAdjacencyEnabled();
else return FaceType::HasVFAdjacency();
}
2012-03-31 03:16:58 +02:00
|
|
|
}
|
|
|
|
template < class VertexType >
|
|
|
|
bool VertexVectorHasPerVertexCurvature(const vertex::vector_ocf<VertexType> &fv)
|
|
|
|
{
|
2014-06-19 10:31:51 +02:00
|
|
|
if(VertexType::HasCurvatureOcf()) return fv.IsCurvatureEnabled();
|
|
|
|
else return VertexType::HasCurvature();
|
Corrected a significant bug in the reflection types for ocf components.
Changed the basic reflection mechanism: Instead of having a function templates over all the four containers now we template over Trimesh and we rely on a second function templated on face/vert that wants a vector<face> ; this second function only is eventually overloaded by another function that needs a vector_ocf of faces.
That is Before we had:
- in complex.h
template < class CType0, class CType1, class CType2 , class CType3>
bool HasPerFaceVFAdjacency (const TriMesh < CType0, CType1, CType2, CType3> & /*m*/) {return TriMesh < CType0 , CType1, CType2, CType3>::FaceContainer::value_type::HasVFAdjacency();}
- in the component_ocf.h
template < class VertContainerType, class FaceType, class Container1, class Container2 >
bool HasPerFaceVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
{
if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
else return FaceType::FaceType::HasVFAdjacency();
}
While now we have:
- in complex.h
template < class FaceType > bool FaceVectorHasPerFaceVFAdjacency (const std::vector<FaceType > &) { return FaceType::HasVFAdjacency(); }
template < class TriMeshType> bool HasPerFaceVFAdjacency (const TriMeshType &m) { return tri::FaceVectorHasPerFaceVFAdjacency (m.vert); }
- and in component_ocf.h
template < class FaceType >
bool FaceVectorHasPerFaceVFAdjacency(const face::vector_ocf<FaceType> &fv)
{
if(FaceType::HasVFAdjacencyOcf()) return fv.IsVFAdjacencyEnabled();
else return FaceType::HasVFAdjacency();
}
2012-03-31 03:16:58 +02:00
|
|
|
}
|
|
|
|
template < class VertexType >
|
|
|
|
bool VertexVectorHasPerVertexCurvatureDir(const vertex::vector_ocf<VertexType> &fv)
|
|
|
|
{
|
2014-06-19 10:31:51 +02:00
|
|
|
if(VertexType::HasCurvatureDirOcf()) return fv.IsCurvatureDirEnabled();
|
|
|
|
else return VertexType::HasCurvatureDir();
|
Corrected a significant bug in the reflection types for ocf components.
Changed the basic reflection mechanism: Instead of having a function templates over all the four containers now we template over Trimesh and we rely on a second function templated on face/vert that wants a vector<face> ; this second function only is eventually overloaded by another function that needs a vector_ocf of faces.
That is Before we had:
- in complex.h
template < class CType0, class CType1, class CType2 , class CType3>
bool HasPerFaceVFAdjacency (const TriMesh < CType0, CType1, CType2, CType3> & /*m*/) {return TriMesh < CType0 , CType1, CType2, CType3>::FaceContainer::value_type::HasVFAdjacency();}
- in the component_ocf.h
template < class VertContainerType, class FaceType, class Container1, class Container2 >
bool HasPerFaceVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
{
if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
else return FaceType::FaceType::HasVFAdjacency();
}
While now we have:
- in complex.h
template < class FaceType > bool FaceVectorHasPerFaceVFAdjacency (const std::vector<FaceType > &) { return FaceType::HasVFAdjacency(); }
template < class TriMeshType> bool HasPerFaceVFAdjacency (const TriMeshType &m) { return tri::FaceVectorHasPerFaceVFAdjacency (m.vert); }
- and in component_ocf.h
template < class FaceType >
bool FaceVectorHasPerFaceVFAdjacency(const face::vector_ocf<FaceType> &fv)
{
if(FaceType::HasVFAdjacencyOcf()) return fv.IsVFAdjacencyEnabled();
else return FaceType::HasVFAdjacency();
}
2012-03-31 03:16:58 +02:00
|
|
|
}
|
2008-12-19 11:31:56 +01:00
|
|
|
|
2012-04-10 18:47:15 +02:00
|
|
|
template < class VertexType >
|
|
|
|
bool VertexVectorHasPerVertexTexCoord(const vertex::vector_ocf<VertexType> &fv)
|
|
|
|
{
|
2014-06-19 10:31:51 +02:00
|
|
|
if(VertexType::HasTexCoordOcf()) return fv.IsTexCoordEnabled();
|
|
|
|
else return VertexType::HasTexCoord();
|
2012-04-10 18:47:15 +02:00
|
|
|
}
|
2008-12-19 11:31:56 +01:00
|
|
|
}
|
|
|
|
}// end namespace vcg
|
|
|
|
#endif
|