vcglib/vcg/simplex/vertexplus/component_occ.h

142 lines
5.6 KiB
C
Raw Normal View History

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 $
2004-03-31 15:15:28 +02:00
2004-03-31 14:46:53 +02:00
****************************************************************************/
#ifndef __VCG_VERTEX_PLUS_COMPONENT_OCC
#define __VCG_VERTEX_PLUS_COMPONENT_OCC
2004-03-31 14:46:53 +02:00
#include <vcg/simplex/vertexplus/component.h>
#include <vcg/container/vector_occ.h>
2004-03-31 14:46:53 +02:00
namespace vcg {
namespace vert {
/*
Some naming Rules
All the Components that can be added to a vertex should be defined in the namespace vert:
*/
/*------------------------- COORD -----------------------------------------*/
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;
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
};
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
template <class A, class T> class NormalOcc: public T {
2004-04-01 00:32:31 +02:00
public:
typedef A NormalType;
NormalType &N() {return CAT< vector_occ<VertType>,NormalType>::Instance()->Get((VertType*)this); }
/*private:
NormalType _norm; */
2004-04-01 00:32:31 +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
2004-03-31 14:46:53 +02:00
/*-------------------------- TEXTURE ----------------------------------------*/
template <class A, class T> class TextureOcc: public T {
2004-04-01 00:32:31 +02:00
public:
typedef A TextureType;
TextureType &T() {return CAT< vector_occ<VertType>,TextureType>::Instance()->Get((VertType*)this); }
2004-04-01 00:32:31 +02:00
static bool HasTexture() { return true; }
/* private:
TextureType _t; */
2004-04-01 00:32:31 +02:00
};
2004-03-31 14:46:53 +02:00
template <class T> class Texture2sOcc: public TextureOcc<TCoord2<short,1>, T> {};
template <class T> class Texture2fOcc: public TextureOcc<TCoord2<float,1>, T> {};
template <class T> class Texture2dOcc: public TextureOcc<TCoord2<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
template <class T> class FlagOcc: public T {
2004-04-01 00:32:31 +02:00
public:
int &Flags() {return CAT< vector_occ<VertType>,int>::Instance()->Get((VertType*)this); }
2004-04-01 00:32:31 +02:00
const int Flags() const {return _flags; }
/*
2004-04-01 00:32:31 +02:00
private:
int _flags; */
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
template <class A, class T> class ColorOcc: public T {
2004-04-01 00:32:31 +02:00
public:
typedef A ColorType;
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; }
/*private:
ColorType _color; */
2004-04-01 00:32:31 +02:00
};
template <class T> class Color4bOcc: public ColorOcc<vcg::Color4b, T> {};
2004-04-01 00:32:31 +02:00
///*-------------------------- Quality ----------------------------------*/
template <class A, class T> class QualityOcc: public T {
2004-04-01 00:32:31 +02:00
public:
typedef A QualityType;
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; }
/*private:
QualityType _quality; */
2004-04-01 00:32:31 +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
//
///*----------------------------- VFADJ ------------------------------*/
template <class T> class VFAdjOcc: public T {
2004-04-01 00:32:31 +02:00
public:
typename T::FacePointer &Fp() {return CAT< vector_occ<VertType>,T::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
#endif