- useless template paramtere in SimpleTempData_Base removed (simple_temporary_data.h)
- Attribute is now derived by SimpleTempData_Base
- SimpleTempData_Base defines a void * At(unsigned int i) function that returns a pointer to the i-th element of the vector withouth knowing the type
- removed the useless member _typeid from the PointerToAttribute. It was used to store the rtti, useless itself.
NOTE: the copy of attributes is done with a memcpy! This means that if you defined a operator = in your attribute this WILL NOT be used in the append.
[ Changes in definition of TriMesh: PART II ]
Note: No changes to existing code need be the done, this mod
should be fully backward compatible
Old way to define a TriMesh ==============
struct MyMesh: public vcg::tri::TriMesh< vector<MyVertex> , vector <MyFace> >{};
new ways to define a TriMesh ==============
struct MyMesh: public vcg::tri::TriMesh< CONT1 >{};
struct MyMesh: public vcg::tri::TriMesh< CONT1 , CONT2>{};
struct MyMesh: public vcg::tri::TriMesh< CONT1 , CONT2, CONT3>{};
where CONT[i] can be vector< [MyVertex | MyEdge | MyFace ] >
(the order is unimportant)
Note for the developers: the change to make to existing projects is very little
but strictly necessary to compile. This change IS NOT backward compliant.
==== OLD ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
class MyVertex: public VertexSimp2 < MyVertex, MyEdge, MyFace, vertex::Coord3f,...other components>{};
class MyFace: public FaceSimp2 < MyVertex, MyEdge, MyFace, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
==== NEW ==== way to define a TriMesh:
// forward declarations
class MyVertex;
class MyEdge;
class MyFace;
// declaration of which types is used as VertexType, which type is used as FaceType and so on...
class MyUsedTypes: public vcg::UsedType < vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyFace>::AsFaceType>{};
class MyVertex: public Vertex < MyUsedTypes, vertex::Coord3f,...other components>{};
class MyFace: public Face < MyUsedTypes, face::VertexRef,...other components>{};
class MyMesh: public TriMesh<vector<MyVertex>,vector<MyFace> >{};
===== classes introduced
[vcg::UsedType] : it is a class containing all the types that must be passed to the definition of Vertex, Face, Edge... This
class replaces the list of typenames to pass as first templates and the need to specify the maximal simplicial. So
<MyVertex, MyEdge, MyFace becomes <MyUsedTypes<
and
VertexSimp2 becomes Vertex
[vcg::Use] : an auxiliary class to give a simple way to specify the role of a type
Note 2: the order of templates parameters to vcg::UsedTypes is unimportant, e.g:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyVertex>::AsVertexType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyFace>::AsFaceType>{};
is the same as:
class MyUsedTypes: public vcg::UsedType <vcg::Use<MyFace>::AsFaceType,
vcg::Use<MyEdge>::AsEdgeType,
vcg::Use<MyVertex>::AsVertexType>{};
Note 3: you only need to specify the type you use. If you do not have edges you do not need
to include vcg::Use<MyEdge>::AsEdgeType in the template list of UsedTypes.
==== the Part II will be a tiny change to the class TriMesh it self.