2004-03-31 14:46:53 +02: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. *
|
|
|
|
|
* *
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
History
|
|
|
|
|
|
|
|
|
|
$Log: not supported by cvs2svn $
|
2008-03-17 12:39:15 +01:00
|
|
|
|
Revision 1.2 2007/03/12 15:37:21 tarini
|
|
|
|
|
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
|
|
|
|
|
|
2007-03-12 16:42:11 +01:00
|
|
|
|
Revision 1.1 2005/10/15 16:24:10 ganovelli
|
2008-03-17 12:39:15 +01:00
|
|
|
|
Working release (compilata solo su MSVC), component_occ <EFBFBD> migrato da component_opt
|
2007-03-12 16:42:11 +01:00
|
|
|
|
|
2004-03-31 15:15:28 +02:00
|
|
|
|
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
|
|
|
|
****************************************************************************/
|
2005-10-15 18:24:10 +02:00
|
|
|
|
#ifndef __VCG_VERTEX_PLUS_COMPONENT_OCC
|
|
|
|
|
#define __VCG_VERTEX_PLUS_COMPONENT_OCC
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
2004-03-31 16:16:40 +02:00
|
|
|
|
#include <vcg/simplex/vertexplus/component.h>
|
2005-10-15 18:24:10 +02:00
|
|
|
|
#include <vcg/container/vector_occ.h>
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace vcg {
|
2008-09-30 12:42:16 +02:00
|
|
|
|
namespace vertex {
|
2004-03-31 14:46:53 +02:00
|
|
|
|
/*
|
|
|
|
|
Some naming Rules
|
|
|
|
|
All the Components that can be added to a vertex should be defined in the namespace vert:
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*------------------------- COORD -----------------------------------------*/
|
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
template <class A, class T> class CoordOcc: public T {
|
2004-03-31 14:46:53 +02:00
|
|
|
|
public:
|
|
|
|
|
typedef A CoordType;
|
|
|
|
|
typedef typename CoordType::ScalarType ScalarType;
|
2008-03-17 12:39:15 +01:00
|
|
|
|
typedef typename T::VertType VertType;
|
2005-10-15 18:24:10 +02:00
|
|
|
|
CoordType &P() { return CAT< vector_occ<VertType>,CoordType>::Instance()->Get((VertType*)this); }
|
|
|
|
|
CoordType &UberP() { return CAT< vector_occ<VertType>,CoordType>::Instance()->Get((VertType*)this); }
|
2004-03-31 14:46:53 +02:00
|
|
|
|
};
|
2005-10-15 18:24:10 +02:00
|
|
|
|
template <class T> class Coord3fOcc: public CoordOcc<vcg::Point3f, T> {};
|
|
|
|
|
template <class T> class Coord3dOcc: public CoordOcc<vcg::Point3d, T> {};
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------- NORMAL ----------------------------------------*/
|
2004-04-01 00:32:31 +02:00
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
template <class A, class T> class NormalOcc: public T {
|
2004-04-01 00:32:31 +02:00
|
|
|
|
public:
|
|
|
|
|
typedef A NormalType;
|
2008-03-17 12:39:15 +01:00
|
|
|
|
typedef typename T::VertType VertType;
|
2005-10-15 18:24:10 +02:00
|
|
|
|
NormalType &N() {return CAT< vector_occ<VertType>,NormalType>::Instance()->Get((VertType*)this); }
|
|
|
|
|
/*private:
|
|
|
|
|
NormalType _norm; */
|
2004-04-01 00:32:31 +02:00
|
|
|
|
};
|
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
template <class T> class Normal3sOcc: public NormalOcc<vcg::Point3s, T> {};
|
|
|
|
|
template <class T> class Normal3fOcc: public NormalOcc<vcg::Point3f, T> {};
|
|
|
|
|
template <class T> class Normal3dOcc: public NormalOcc<vcg::Point3d, T> {};
|
2004-04-01 00:32:31 +02:00
|
|
|
|
|
2007-03-12 16:42:11 +01:00
|
|
|
|
/*-------------------------- TEXCOORD ----------------------------------------*/
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
2008-03-17 12:39:15 +01:00
|
|
|
|
template <class A, class TT> class TexCoordOcc: public TT {
|
2004-04-01 00:32:31 +02:00
|
|
|
|
public:
|
2007-03-12 16:42:11 +01:00
|
|
|
|
typedef A TexCoordType;
|
2008-03-17 12:39:15 +01:00
|
|
|
|
typedef typename TT::VertType VertType;
|
2007-03-12 16:42:11 +01:00
|
|
|
|
TexCoordType &T() {return CAT< vector_occ<VertType>,TexCoordType>::Instance()->Get((VertType*)this); }
|
|
|
|
|
static bool HasTexCoord() { return true; }
|
2008-03-17 12:39:15 +01:00
|
|
|
|
static bool HasTexCoordOcc() { return true; }
|
2004-04-01 00:32:31 +02:00
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
/* private:
|
2007-03-12 16:42:11 +01:00
|
|
|
|
TexCoordType _t; */
|
2004-04-01 00:32:31 +02:00
|
|
|
|
};
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
2007-03-12 16:42:11 +01:00
|
|
|
|
template <class T> class TexCoord2sOcc: public TexCoordOcc<TexCoord2<short,1>, T> {};
|
|
|
|
|
template <class T> class TexCoord2fOcc: public TexCoordOcc<TexCoord2<float,1>, T> {};
|
|
|
|
|
template <class T> class TexCoord2dOcc: public TexCoordOcc<TexCoord2<double,1>, T> {};
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
2004-04-01 00:32:31 +02:00
|
|
|
|
///*------------------------- FLAGS -----------------------------------------*/
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
template <class T> class FlagOcc: public T {
|
2004-04-01 00:32:31 +02:00
|
|
|
|
public:
|
2008-03-17 12:39:15 +01:00
|
|
|
|
typedef typename T::VertType VertType;
|
2005-10-15 18:24:10 +02:00
|
|
|
|
int &Flags() {return CAT< vector_occ<VertType>,int>::Instance()->Get((VertType*)this); }
|
2008-03-17 12:39:15 +01:00
|
|
|
|
const int Flags() const {return CAT< vector_occ<VertType>,int>::Instance()->Get((VertType*)this); }
|
|
|
|
|
static bool HasFlags() {return true;}
|
|
|
|
|
static bool HasFlagsOcc() {return true;}
|
|
|
|
|
|
|
|
|
|
|
2004-04-01 00:32:31 +02:00
|
|
|
|
};
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
2004-04-01 00:32:31 +02:00
|
|
|
|
///*-------------------------- COLOR ----------------------------------*/
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
template <class A, class T> class ColorOcc: public T {
|
2004-04-01 00:32:31 +02:00
|
|
|
|
public:
|
|
|
|
|
typedef A ColorType;
|
2008-03-17 12:39:15 +01:00
|
|
|
|
typedef typename T::VertType VertType;
|
2005-10-15 18:24:10 +02:00
|
|
|
|
ColorType &C() { return CAT< vector_occ<VertType>,ColorType>::Instance()->Get((VertType*)this); }
|
2004-04-01 00:32:31 +02:00
|
|
|
|
static bool HasColor() { return true; }
|
2005-10-15 18:24:10 +02:00
|
|
|
|
/*private:
|
|
|
|
|
ColorType _color; */
|
2004-04-01 00:32:31 +02:00
|
|
|
|
};
|
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
template <class T> class Color4bOcc: public ColorOcc<vcg::Color4b, T> {};
|
2004-04-01 00:32:31 +02:00
|
|
|
|
|
|
|
|
|
///*-------------------------- Quality ----------------------------------*/
|
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
template <class A, class T> class QualityOcc: public T {
|
2004-04-01 00:32:31 +02:00
|
|
|
|
public:
|
|
|
|
|
typedef A QualityType;
|
2008-03-17 12:39:15 +01:00
|
|
|
|
typedef typename T::VertType VertType;
|
2005-10-15 18:24:10 +02:00
|
|
|
|
QualityType &Q() { return CAT< vector_occ<VertType>,QualityType>::Instance()->Get((VertType*)this);}
|
2004-04-01 00:32:31 +02:00
|
|
|
|
static bool HasQuality() { return true; }
|
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
/*private:
|
|
|
|
|
QualityType _quality; */
|
2004-04-01 00:32:31 +02:00
|
|
|
|
};
|
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
template <class T> class QualitysOcc: public QualityOcc<short, T> {};
|
|
|
|
|
template <class T> class QualityfOcc: public QualityOcc<float, T> {};
|
|
|
|
|
template <class T> class QualitydOcc: public QualityOcc<double, T> {};
|
2004-04-01 00:32:31 +02:00
|
|
|
|
//
|
2008-03-17 12:39:15 +01:00
|
|
|
|
|
|
|
|
|
///*-------------------------- Curvature ----------------------------------*/
|
|
|
|
|
|
|
|
|
|
template <class A, class TT> class CurvatureOcc: public TT {
|
|
|
|
|
public:
|
|
|
|
|
typedef Point2<A> CurvatureTypeOcc;
|
|
|
|
|
typedef typename TT::VertType VertType;
|
|
|
|
|
typedef typename CurvatureTypeOcc::ScalarType ScalarType;
|
|
|
|
|
|
|
|
|
|
ScalarType &H(){ return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0];}
|
|
|
|
|
ScalarType &K(){ return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1];}
|
|
|
|
|
const ScalarType &cH() const { return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0];}
|
|
|
|
|
const ScalarType &cK() const { return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1];}
|
|
|
|
|
|
|
|
|
|
template <class LeftV>
|
|
|
|
|
void ImportLocal(const LeftV & leftV){
|
|
|
|
|
CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0] = leftV.cH();
|
|
|
|
|
CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1] = leftV.cK();
|
|
|
|
|
TT::ImporLocal(leftV);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool HasCurvature() { return true; }
|
|
|
|
|
static bool HasCurvatureOcc() { return true; }
|
|
|
|
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureOcc"));TT::Name(name);}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template <class T> class CurvaturefOcc: public CurvatureOcc<float, T> {
|
|
|
|
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturefOcc"));T::Name(name);}
|
|
|
|
|
};
|
|
|
|
|
template <class T> class CurvaturedOcc: public CurvatureOcc<double, T> {
|
|
|
|
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturedOcc"));T::Name(name);}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------- Curvature Direction ----------------------------------*/
|
|
|
|
|
|
|
|
|
|
template <class S>
|
|
|
|
|
struct CurvatureDirTypeOcc{
|
|
|
|
|
typedef Point3<S> VecType;
|
|
|
|
|
typedef S ScalarType;
|
|
|
|
|
CurvatureDirTypeOcc () {}
|
|
|
|
|
Point3<S>max_dir,min_dir; // max and min curvature direction
|
|
|
|
|
S k1,k2;// max and min curvature values
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <class A, class TT> class CurvatureDirOcc: public TT {
|
|
|
|
|
public:
|
|
|
|
|
typedef A CurvatureDirTypeOcc;
|
|
|
|
|
typedef typename CurvatureDirTypeOcc::VecType VecType;
|
|
|
|
|
typedef typename CurvatureDirTypeOcc::ScalarType ScalarType;
|
|
|
|
|
typedef typename TT::VertType VertType;
|
|
|
|
|
|
|
|
|
|
VecType &PD1(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;}
|
|
|
|
|
VecType &PD2(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;}
|
|
|
|
|
const VecType &cPD1() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;}
|
|
|
|
|
const VecType &cPD2() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;}
|
|
|
|
|
|
|
|
|
|
ScalarType &K1(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;}
|
|
|
|
|
ScalarType &K2(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;}
|
|
|
|
|
const ScalarType &cK1() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;}
|
|
|
|
|
const ScalarType &cK2()const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;}
|
|
|
|
|
|
|
|
|
|
static bool HasCurvatureDir() { return true; }
|
|
|
|
|
static bool HasCurvatureDirOcc() { return true; }
|
|
|
|
|
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDir"));TT::Name(name);}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
template <class T> class CurvatureDirfOcc: public CurvatureDirOcc<CurvatureDirTypeOcc<float>, T> {
|
|
|
|
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirf"));T::Name(name);}
|
|
|
|
|
};
|
|
|
|
|
template <class T> class CurvatureDirdOcc: public CurvatureDirOcc<CurvatureDirTypeOcc<double>, T> {
|
|
|
|
|
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDird"));T::Name(name);}
|
|
|
|
|
};
|
|
|
|
|
|
2004-04-01 00:32:31 +02:00
|
|
|
|
///*----------------------------- VFADJ ------------------------------*/
|
|
|
|
|
|
2005-10-15 18:24:10 +02:00
|
|
|
|
template <class T> class VFAdjOcc: public T {
|
2004-04-01 00:32:31 +02:00
|
|
|
|
public:
|
2008-03-17 12:39:15 +01:00
|
|
|
|
typedef typename T::VertType VertType;
|
|
|
|
|
typedef typename T::FacePointer FacePointer;
|
|
|
|
|
FacePointer &Fp() {return CAT< vector_occ<VertType>,FacePointer>::Instance()->Get((VertType*)this); }
|
2004-04-01 00:32:31 +02:00
|
|
|
|
int &Zp() {return _zp; }
|
|
|
|
|
static bool HasVFAdjacency() { return true; }
|
|
|
|
|
private:
|
|
|
|
|
typename T::FacePointer _fp ;
|
|
|
|
|
int _zp ;
|
|
|
|
|
};
|
2004-03-31 14:46:53 +02:00
|
|
|
|
|
|
|
|
|
} // end namespace vert
|
|
|
|
|
}// end namespace vcg
|
2007-03-12 16:42:11 +01:00
|
|
|
|
#endif
|