While the many RequireXXX functions allow to check the static correctness of a mesh and
have a O(1) complexity, in many cases we need to run more complex checks to be sure that
the subsequent algorithm can run without issues.
Typical cases are the fact that there are no unreferenced vertices (NoUnreferencedVertex)
or a given adjacency is correctly initialized (and not only statically present as a type component).
- Cleaned up include order: Now you only need to include <vcg/complex/complex.h> (no more vertex/base.h etc)
- Added official VN() EN() FN() const members for knowing number of vertexes etc...
- Added exceptions (at last!)
Now instead of:
assert(HasPerVertexNormal(m))
you should write:
if(!HasPerFaceNormal(m)) throw vcg::MissingComponentException();
Changed the basic reflection mechanism: Instead of having a function templates over all the four containers now we template over Trimesh and we rely on a second function templated on face/vert that wants a vector<face> ; this second function only is eventually overloaded by another function that needs a vector_ocf of faces.
That is Before we had:
- in complex.h
template < class CType0, class CType1, class CType2 , class CType3>
bool HasPerFaceVFAdjacency (const TriMesh < CType0, CType1, CType2, CType3> & /*m*/) {return TriMesh < CType0 , CType1, CType2, CType3>::FaceContainer::value_type::HasVFAdjacency();}
- in the component_ocf.h
template < class VertContainerType, class FaceType, class Container1, class Container2 >
bool HasPerFaceVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m)
{
if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled();
else return FaceType::FaceType::HasVFAdjacency();
}
While now we have:
- in complex.h
template < class FaceType > bool FaceVectorHasPerFaceVFAdjacency (const std::vector<FaceType > &) { return FaceType::HasVFAdjacency(); }
template < class TriMeshType> bool HasPerFaceVFAdjacency (const TriMeshType &m) { return tri::FaceVectorHasPerFaceVFAdjacency (m.vert); }
- and in component_ocf.h
template < class FaceType >
bool FaceVectorHasPerFaceVFAdjacency(const face::vector_ocf<FaceType> &fv)
{
if(FaceType::HasVFAdjacencyOcf()) return fv.IsVFAdjacencyEnabled();
else return FaceType::HasVFAdjacency();
}
- 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.