Now the compactvertex and compactface funtions use the importlocal chain so we are sure that all the meaningful data is correctly copied (otherwise ocf stuff will not be copied) On the other hand when using ImportLocal we do not copy pointer based stuff like adjacency and *vertex pointers* that must be terefore copied by hand...
This commit is contained in:
parent
87599e519f
commit
446400f6fc
|
@ -193,7 +193,7 @@ namespace vcg {
|
||||||
// this one is called by the Compact and overridden by more specialized functions for OCF classes.
|
// this one is called by the Compact and overridden by more specialized functions for OCF classes.
|
||||||
// that manage also the additional types
|
// that manage also the additional types
|
||||||
template <class face_type>
|
template <class face_type>
|
||||||
void ReorderFace( std::vector<size_t> &newVertIndex, std::vector<face_type> &vert)
|
void ReorderFace( std::vector<size_t> & /*newVertIndex*/, std::vector<face_type> & /*vert*/)
|
||||||
{}
|
{}
|
||||||
template <class vertex_type>
|
template <class vertex_type>
|
||||||
void ReorderVert( std::vector<size_t> &newVertIndex, std::vector<vertex_type> &vert)
|
void ReorderVert( std::vector<size_t> &newVertIndex, std::vector<vertex_type> &vert)
|
||||||
|
@ -582,7 +582,7 @@ namespace vcg {
|
||||||
for(unsigned int i=0;i<m.vert.size();++i)
|
for(unsigned int i=0;i<m.vert.size();++i)
|
||||||
{
|
{
|
||||||
if(newVertIndex[i]<size_t(m.vn))
|
if(newVertIndex[i]<size_t(m.vn))
|
||||||
m.vert[ newVertIndex[i] ]=m.vert[i];
|
m.vert[ newVertIndex[i] ].ImportLocal(m.vert[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// call a templated reordering function that manage any additional data internally stored by the vector
|
// call a templated reordering function that manage any additional data internally stored by the vector
|
||||||
|
@ -660,7 +660,12 @@ namespace vcg {
|
||||||
if(!m.face[i].IsD())
|
if(!m.face[i].IsD())
|
||||||
{
|
{
|
||||||
if(pos!=i)
|
if(pos!=i)
|
||||||
m.face[pos]=m.face[i];
|
{
|
||||||
|
m.face[pos].ImportLocal(m.face[i]);
|
||||||
|
m.face[pos].V(0) = m.face[i].V(0);
|
||||||
|
m.face[pos].V(1) = m.face[i].V(1);
|
||||||
|
m.face[pos].V(2) = m.face[i].V(2);
|
||||||
|
}
|
||||||
newFaceIndex[i]=pos;
|
newFaceIndex[i]=pos;
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,6 +173,9 @@ public:
|
||||||
inline typename T::VertexType * & UberV( const int j ) { assert(j>=0 && j<3); return v[j]; }
|
inline typename T::VertexType * & UberV( const int j ) { assert(j>=0 && j<3); return v[j]; }
|
||||||
inline const typename T::VertexType * const & UberV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
|
inline const typename T::VertexType * const & UberV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
|
||||||
|
|
||||||
|
// Small comment about the fact that the pointers are zero filled.
|
||||||
|
// The importLocal is meant for copyng stuff between very different meshes, so copying the pointers would be meaningless.
|
||||||
|
// if you are using ImportLocal for copying internally simplex you have to set up all the pointers by hand.
|
||||||
template <class RightF>
|
template <class RightF>
|
||||||
void ImportLocal(const RightF & rightF){ V(0) = NULL; V(1) = NULL; V(2) = NULL; T::ImportLocal(rightF);}
|
void ImportLocal(const RightF & rightF){ V(0) = NULL; V(1) = NULL; V(2) = NULL; T::ImportLocal(rightF);}
|
||||||
inline void Alloc(const int & ns){T::Alloc(ns);}
|
inline void Alloc(const int & ns){T::Alloc(ns);}
|
||||||
|
|
Loading…
Reference in New Issue