diff --git a/vcg/complex/used_types.h b/vcg/complex/used_types.h index fdadac6e..ae289825 100755 --- a/vcg/complex/used_types.h +++ b/vcg/complex/used_types.h @@ -11,8 +11,10 @@ #include #include #include +#include #include #include +#include #include #include #include diff --git a/vcg/simplex/face/component_ocf.h b/vcg/simplex/face/component_ocf.h index 13fdd174..af941e62 100644 --- a/vcg/simplex/face/component_ocf.h +++ b/vcg/simplex/face/component_ocf.h @@ -31,11 +31,9 @@ Mainly the trick here is to store a base pointer in each simplex... ****************************************************************************/ #ifndef __VCG_FACE_PLUS_COMPONENT_OCF #define __VCG_FACE_PLUS_COMPONENT_OCF - -#include -#include -#include - +#ifndef __VCG_MESH +#error "This file should not be included alone. It is automatically included by complex.h" +#endif namespace vcg { namespace face { @@ -50,17 +48,18 @@ class vector_ocf: public std::vector { typedef typename vector_ocf::iterator ThisTypeIterator; public: - vector_ocf():std::vector(){ - ColorEnabled=false; - QualityEnabled=false; - MarkEnabled=false; - NormalEnabled=false; - CurvatureDirEnabled = false; - WedgeTexEnabled=false; - VFAdjacencyEnabled=false; - FFAdjacencyEnabled=false; - WedgeColorEnabled=false; - WedgeNormalEnabled=false; + vector_ocf():std::vector() + { + ColorEnabled=false; + CurvatureDirEnabled = false; + MarkEnabled=false; + NormalEnabled=false; + QualityEnabled=false; + WedgeTexEnabled=false; + WedgeColorEnabled=false; + WedgeNormalEnabled=false; + VFAdjacencyEnabled=false; + FFAdjacencyEnabled=false; } // Auxiliary types to build internal vectors @@ -125,9 +124,10 @@ public: }; - // override di tutte le funzioni che possono spostare - // l'allocazione in memoria del container - void push_back(const VALUE_TYPE & v) +//////////////////////////////////////// +// 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) { BaseType::push_back(v); BaseType::back()._ovp = this; @@ -375,27 +375,27 @@ void DisableWedgeNormal() { } public: - std::vector QV; std::vector CV; + std::vector CDV; std::vector MV; std::vector NV; - std::vector CDV; - std::vector AV; - std::vector AF; - std::vector WTV; + std::vector QV; std::vector WCV; std::vector WNV; + std::vector WTV; + std::vector AV; + std::vector AF; - bool QualityEnabled; bool ColorEnabled; + bool CurvatureDirEnabled; bool MarkEnabled; bool NormalEnabled; - bool CurvatureDirEnabled; + bool QualityEnabled; + bool WedgeColorEnabled; + bool WedgeNormalEnabled; bool WedgeTexEnabled; bool VFAdjacencyEnabled; bool FFAdjacencyEnabled; - bool WedgeColorEnabled; - bool WedgeNormalEnabled; }; // end class vector_ocf @@ -826,6 +826,12 @@ public: else return FaceType::HasCurvatureDir(); } template < class FaceType > + bool FaceVectorHasPerFaceNormal(const face::vector_ocf &fv) + { + if(FaceType::HasFaceNormalOcf()) return fv.IsNormalEnabled(); + else return FaceType::HasFaceNormal(); + } + template < class FaceType > void ReorderFace( std::vector &newFaceIndex, face::vector_ocf< FaceType > &faceVec) { faceVec.ReorderFace(newFaceIndex); diff --git a/vcg/simplex/vertex/component_ocf.h b/vcg/simplex/vertex/component_ocf.h index 7b9daaa8..bbd05f1d 100644 --- a/vcg/simplex/vertex/component_ocf.h +++ b/vcg/simplex/vertex/component_ocf.h @@ -19,65 +19,6 @@ * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * for more details. * * * -****************************************************************************/ -/**************************************************************************** - History - -$Log: not supported by cvs2svn $ -Revision 1.16 2008/04/03 23:15:40 cignoni -added optional mark and cleaned up some nasty type bugs. - -Revision 1.15 2008/03/17 11:39:15 ganovelli -added curvature and curvatruredir (compiled .net 2005 and gcc) - -Revision 1.14 2008/03/11 09:22:07 cignoni -Completed the garbage collecting functions CompactVertexVector and CompactFaceVector. - -Revision 1.13 2008/02/05 20:42:43 cignoni -Other small typos - -Revision 1.12 2008/02/04 21:26:49 ganovelli -added ImportData which imports all local attributes into vertexplus and faceplus. -A local attribute is everything (N(), C(), Q()....) except pointers to other simplices -(i.e. FFAdj, VFAdj, VertexRef) which are set to NULL. -Added some function for const attributes - -Revision 1.11 2007/12/11 18:25:31 cignoni -added missing include limits - -Revision 1.10 2007/12/11 11:36:03 cignoni -Added the CompactVertexVector garbage collecting function. - -Revision 1.9 2006/12/11 23:42:00 ganovelli -bug Index()() instead of Index() - -Revision 1.8 2006/12/04 11:17:42 ganovelli -added forward declaration of TriMesh - -Revision 1.7 2006/11/07 17:22:52 cignoni -many gcc compiling issues - -Revision 1.6 2006/11/07 15:13:57 zifnab1974 -Necessary changes for compilation with gcc 3.4.6. Especially the hash function is a problem - -Revision 1.5 2006/11/07 11:29:24 cignoni -Corrected some errors in the reflections Has*** functions - -Revision 1.4 2006/10/31 16:02:59 ganovelli -vesione 2005 compliant - -Revision 1.3 2006/02/28 11:59:55 ponchio -g++ compliance: - -begin() -> (*this).begin() and for end(), size(), Base(), Index() - -Revision 1.2 2005/12/12 11:17:32 cignoni -Corrected update function, now only the needed simplexes should be updated. - -Revision 1.1 2005/10/14 15:07:59 cignoni -First Really Working version - - ****************************************************************************/ /* @@ -90,11 +31,9 @@ Mainly the trick here is to store a base pointer in each simplex... ****************************************************************************/ #ifndef __VCG_VERTEX_PLUS_COMPONENT_OCF #define __VCG_VERTEX_PLUS_COMPONENT_OCF - -#include - -#include -#include +#ifndef __VCG_MESH +#error "This file should not be included alone. It is automatically included by complex.h" +#endif namespace vcg { namespace vertex { @@ -108,21 +47,23 @@ class vector_ocf: public std::vector { typedef typename vector_ocf::iterator ThisTypeIterator; public: - vector_ocf():std::vector(){ - ColorEnabled = false; + vector_ocf():std::vector() + { + ColorEnabled = false; CurvatureEnabled = false; CurvatureDirEnabled = false; MarkEnabled = false; - NormalEnabled = false; + NormalEnabled = false; QualityEnabled = false; RadiusEnabled = false; TexCoordEnabled = false; - VFAdjacencyEnabled = false; - } + VFAdjacencyEnabled = false; + } - // override di tutte le funzioni che possono spostare - // l'allocazione in memoria del container - void push_back(const VALUE_TYPE & v) +//////////////////////////////////////// +// 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) { BaseType::push_back(v); BaseType::back()._ovp = this; @@ -135,7 +76,9 @@ public: if (CurvatureDirEnabled) CuDV.push_back(typename VALUE_TYPE::CurvatureDirType()); if (RadiusEnabled) RadiusV.push_back(typename VALUE_TYPE::RadiusType()); } + void pop_back(); + void resize(const unsigned int & _size) { const unsigned int oldsize = BaseType::size(); @@ -304,21 +247,21 @@ struct VFAdjType { public: std::vector CV; std::vector CuV; - std::vector CuDV; + std::vector CuDV; std::vector MV; std::vector NV; std::vector QV; - std::vector RadiusV; - std::vector TV; - std::vector AV; + std::vector RadiusV; + std::vector TV; + std::vector AV; bool ColorEnabled; - bool CurvatureEnabled; - bool CurvatureDirEnabled; + bool CurvatureEnabled; + bool CurvatureDirEnabled; bool MarkEnabled; bool NormalEnabled; bool QualityEnabled; - bool RadiusEnabled; + bool RadiusEnabled; bool TexCoordEnabled; bool VFAdjacencyEnabled; };