/**************************************************************************** * 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 $ Revision 1.3 2004/03/31 12:28:37 ganovelli *** empty log message *** Revision 1.2 2004/03/29 14:26:38 cignoni Error in color Revision 1.1 2004/03/29 08:36:26 cignoni First working version! ****************************************************************************/ #ifndef __VCG_VERTEX_PLUS_COMPONENT #define __VCG_VERTEX_PLUS_COMPONENT 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 EmptyCoord: public T { public: typedef vcg::Point3f CoordType; typedef CoordType::ScalarType ScalarType; CoordType &P() { static CoordType coord(0, 0, 0); return coord; } CoordType &UberP() { static CoordType coord(0, 0, 0); return coord; } }; template class Coord: public T { public: typedef A CoordType; typedef typename CoordType::ScalarType ScalarType; CoordType &P() { return _coord; } CoordType &UberP() { return _coord; } private: CoordType _coord; }; template class Coord3f: public Coord {}; template class Coord3d: public Coord {}; /*-------------------------- NORMAL ----------------------------------------*/ template class EmptyNormal: public T { public: typedef vcg::Point3s NormalType; NormalType &N() { static NormalType dummy_normal(0, 0, 0); return dummy_normal; } }; template class Normal: public T { public: typedef A NormalType; NormalType &N() { return _norm; } private: NormalType _norm; }; template class Normal3s: public Normal {}; template class Normal3f: public Normal {}; template class Normal3d: public Normal {}; /*-------------------------- NORMAL ----------------------------------------*/ template class EmptyTexture: public T { public: typedef vcg::TCoord2 TextureType; TextureType &T() { static TextureType dummy_texture; return dummy_texture; } static bool HasTexture() { return false; } }; template class Texture: public T { public: typedef A TextureType; TextureType &T() { return _t; } static bool HasTexture() { return true; } private: TextureType _t; }; template class Texture2s: public Texture, T> {}; template class Texture2f: public Texture, T> {}; template class Texture2d: public Texture, T> {}; /*------------------------- FLAGS -----------------------------------------*/ template class EmptyFlag: public T { public: /// Return the vector of Flags(), senza effettuare controlli sui bit int &Flags() { static int dummyflags(0); return dummyflags; } const int Flags() const { return 0; } }; template class Flag: public T { public: int &Flags() {return _flags; } const int Flags() const {return _flags; } private: int _flags; }; /*-------------------------- COLOR ----------------------------------*/ template class EmptyColor: public T { public: typedef vcg::Point3f ColorType; ColorType &C() { static ColorType color(0, 0, 0); return color; } static bool HasColor() { return false; } }; template class Color: public T { public: typedef A ColorType; ColorType &C() { return _color; } static bool HasColor() { return true; } private: ColorType _color; }; template class Color4b: public Color {}; /*-------------------------- Quality ----------------------------------*/ template class EmptyQuality: public T { public: typedef float QualityType; QualityType &Q() { static QualityType dummyQuality(0); return dummyQuality; } static bool HasQuality() { return false; } }; template class Quality: public T { public: typedef A QualityType; QualityType &Q() { return _quality; } static bool HasQuality() { return true; } private: QualityType _quality; }; template class Qualitys: public Quality {}; template class Qualityf: public Quality {}; template class Qualityd: public Quality {}; /*----------------------------- VFADJ ------------------------------*/ template class EmptyVFAdj: public T { public: typename T::FacePointer &Fp() { static typename T::FacePointer fp=0; return fp; } int &Zp(){static int z=0; return z;}; static bool HasVFAdjacency() { return false; } }; template class VFAdj: public T { public: typename T::FacePointer &Fp() {return _fp; } int &Zp() {return _zp; } static bool HasVFAdjacency() { return true; } private: typename T::FacePointer _fp ; int _zp ; }; } // end namespace vert }// end namespace vcg #endif