Added some practical typedefs for simpler use of attributes

This commit is contained in:
Paolo Cignoni 2014-11-12 00:19:18 +00:00
parent 9d89004760
commit 6458dd30ad
2 changed files with 13 additions and 0 deletions

View File

@ -264,6 +264,7 @@ class TriMesh
PerVertexAttributeHandle( void *ah,const int & n):AttributeHandle<ATTR_TYPE,VertContainer>(ah,n){}
};
template <class ATTR_TYPE>
class PerFaceAttributeHandle: public AttributeHandle<ATTR_TYPE,FaceContainer>{
public:
@ -294,6 +295,17 @@ class TriMesh
ATTR_TYPE & operator ()(){ return *((Attribute<ATTR_TYPE> *)_handle)->attribute;}
};
// Some common Handle typedefs to simplify use
typedef typename MeshType::template PerVertexAttributeHandle<ScalarType> PerVertexScalarHandle;
typedef typename MeshType::template PerVertexAttributeHandle<int> PerVertexIntHandle;
typedef typename MeshType::template PerVertexAttributeHandle<bool> PerVertexBoolHandle;
typedef typename MeshType::template PerVertexAttributeHandle<CoordType> PerVertexCoordHandle;
typedef typename MeshType::template PerFaceAttributeHandle<ScalarType> PerFaceScalarHandle;
typedef typename MeshType::template PerFaceAttributeHandle<int> PerFaceIntHandle;
typedef typename MeshType::template PerFaceAttributeHandle<bool> PerFaceBoolHandle;
typedef typename MeshType::template PerFaceAttributeHandle<CoordType> PerFaceCoordHandle;
// the camera member (that should keep the intrinsics) is no more needed since 2006, when intrisncs moved into the Shot structure
//Camera<ScalarType> camera; // intrinsic

View File

@ -7,6 +7,7 @@
#include <vcg/math/shot.h>
#include <vcg/space/texcoord2.h>
#include <vcg/space/triangle3.h>
#include <vcg/space/polygon3.h>
#include <vcg/container/derivation_chain.h>
#include <vcg/complex/all_types.h>