Include header cleaning and reordering.
This commit is contained in:
parent
d4eb599a66
commit
84c80a1972
|
@ -1,46 +1,64 @@
|
|||
/****************************************************************************
|
||||
* VCGLib o o *
|
||||
* Visual and Computer Graphics Library o o *
|
||||
* _ O _ *
|
||||
* Copyright(C) 2004-2012 \/)\/ *
|
||||
* Visual Computing Lab /\/| *
|
||||
* ISTI - Italian National Research Council | *
|
||||
* \ *
|
||||
* All rights reserved. *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
||||
* for more details. *
|
||||
* *
|
||||
****************************************************************************/
|
||||
#ifndef VCG_TRI_ATTRIBUTE_SEAM_H
|
||||
#define VCG_TRI_ATTRIBUTE_SEAM_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <vcg/complex/allocate.h>
|
||||
|
||||
/*
|
||||
|
||||
// sample extract functor
|
||||
void v_extract(const src_mesh_t & wm, const src_face_t & f, int k, const dst_mesh_t & vm, dst_vertex_t & v)
|
||||
{
|
||||
(void)wm;
|
||||
(void)vm;
|
||||
(void)wm;
|
||||
(void)vm;
|
||||
|
||||
v.P() = f.cP (k);
|
||||
v.N() = f.cWN(k);
|
||||
v.C() = f.cWC(k);
|
||||
v.T() = f.cWT(k);
|
||||
v.P() = f.cP (k);
|
||||
v.N() = f.cWN(k);
|
||||
v.C() = f.cWC(k);
|
||||
v.T() = f.cWT(k);
|
||||
}
|
||||
|
||||
// sample compare functor
|
||||
bool v_compare(const dst_mesh_t & vm, const dst_vertex_t & u, const dst_vertex_t & v)
|
||||
{
|
||||
(void)vm;
|
||||
(void)vm;
|
||||
|
||||
return
|
||||
(
|
||||
(u.cN() == v.cN())
|
||||
&& (u.cC() == v.cC())
|
||||
&& (u.cT() == v.cT())
|
||||
);
|
||||
return
|
||||
(
|
||||
(u.cN() == v.cN())
|
||||
&& (u.cC() == v.cC())
|
||||
&& (u.cT() == v.cT())
|
||||
);
|
||||
}
|
||||
|
||||
// sample copy functor
|
||||
void v_copy(const dst_mesh_t & vm, const dst_vertex_t & u, dst_vertex_t & v)
|
||||
{
|
||||
(void)vm;
|
||||
(void)vm;
|
||||
|
||||
v.P() = u.cP();
|
||||
v.N() = u.cN();
|
||||
v.C() = u.cC();
|
||||
v.T() = u.cT();
|
||||
v.P() = u.cP();
|
||||
v.N() = u.cN();
|
||||
v.C() = u.cC();
|
||||
v.T() = u.cT();
|
||||
}
|
||||
|
||||
// create seams
|
||||
|
@ -56,310 +74,310 @@ namespace tri
|
|||
|
||||
class AttributeSeam
|
||||
{
|
||||
public:
|
||||
|
||||
typedef AttributeSeam ThisType;
|
||||
|
||||
enum ASMask
|
||||
{
|
||||
POSITION_PER_VERTEX = (1 << 0),
|
||||
|
||||
NORMAL_PER_VERTEX = (1 << 1),
|
||||
NORMAL_PER_WEDGE = (1 << 2),
|
||||
NORMAL_PER_FACE = (1 << 3),
|
||||
|
||||
COLOR_PER_VERTEX = (1 << 4),
|
||||
COLOR_PER_WEDGE = (1 << 5),
|
||||
COLOR_PER_FACE = (1 << 6),
|
||||
|
||||
TEXCOORD_PER_VERTEX = (1 << 7),
|
||||
TEXCOORD_PER_WEDGE = (1 << 8)
|
||||
};
|
||||
|
||||
template <typename src_trimesh_t, typename dst_trimesh_t>
|
||||
struct ASExtract
|
||||
{
|
||||
const unsigned int mask;
|
||||
|
||||
ASExtract(unsigned int vmask = 0) : mask(vmask)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void operator () (const src_trimesh_t & sm, const typename src_trimesh_t::FaceType & f, int k, const dst_trimesh_t & dm, typename dst_trimesh_t::VertexType & v) const
|
||||
{
|
||||
(void)sm;
|
||||
(void)dm;
|
||||
|
||||
const unsigned int m = this->mask;
|
||||
const typename src_trimesh_t::VertexType & u = *(f.cV(k));
|
||||
|
||||
if ((m & AttributeSeam::POSITION_PER_VERTEX) != 0) v.P() = f.cP (k);
|
||||
|
||||
if ((m & AttributeSeam::NORMAL_PER_VERTEX) != 0) v.N() = u.cN ( );
|
||||
if ((m & AttributeSeam::NORMAL_PER_WEDGE) != 0) v.N() = f.cWN(k);
|
||||
if ((m & AttributeSeam::NORMAL_PER_FACE) != 0) v.N() = f.cN ( );
|
||||
|
||||
if ((m & AttributeSeam::COLOR_PER_VERTEX) != 0) v.C() = u.cC ( );
|
||||
if ((m & AttributeSeam::COLOR_PER_WEDGE) != 0) v.C() = f.cWC(k);
|
||||
if ((m & AttributeSeam::COLOR_PER_FACE) != 0) v.C() = f.cC ( );
|
||||
|
||||
if ((m & AttributeSeam::TEXCOORD_PER_VERTEX) != 0) v.T() = u.cT ( );
|
||||
if ((m & AttributeSeam::TEXCOORD_PER_WEDGE) != 0) v.T() = f.cWT(k);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename dst_trimesh_t>
|
||||
struct ASCompare
|
||||
{
|
||||
const unsigned int mask;
|
||||
|
||||
ASCompare(unsigned int vmask = 0) : mask(vmask)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
bool operator () (const dst_trimesh_t & sm, const typename dst_trimesh_t::VertexType & u, const typename dst_trimesh_t::VertexType & v) const
|
||||
{
|
||||
(void)sm;
|
||||
|
||||
const unsigned int m = this->mask;
|
||||
|
||||
/*
|
||||
if ((m & (AttributeSeam::POSITION_PER_VERTEX)) != 0)
|
||||
{
|
||||
if (u.cP() != v.cP()) return false;
|
||||
}
|
||||
*/
|
||||
|
||||
if ((m & (AttributeSeam::NORMAL_PER_VERTEX | AttributeSeam::NORMAL_PER_WEDGE | AttributeSeam::NORMAL_PER_FACE)) != 0)
|
||||
{
|
||||
if (u.cN() != v.cN()) return false;
|
||||
}
|
||||
|
||||
if ((m & (AttributeSeam::COLOR_PER_VERTEX | AttributeSeam::COLOR_PER_WEDGE | AttributeSeam::COLOR_PER_FACE)) != 0)
|
||||
{
|
||||
if (u.cC() != v.cC()) return false;
|
||||
}
|
||||
|
||||
if ((m & (AttributeSeam::TEXCOORD_PER_VERTEX | AttributeSeam::TEXCOORD_PER_WEDGE)) != 0)
|
||||
{
|
||||
if (u.cT() != v.cT()) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// in-place version
|
||||
template <typename src_trimesh_t, typename extract_wedge_attribs_t, typename compare_vertex_attribs_t>
|
||||
static inline bool SplitVertex(src_trimesh_t & src, extract_wedge_attribs_t v_extract, compare_vertex_attribs_t & v_compare)
|
||||
{
|
||||
typedef typename src_trimesh_t::VertexType src_vertex_t;
|
||||
typedef typename src_trimesh_t::VertexIterator src_vertex_i;
|
||||
typedef typename src_trimesh_t::FaceType src_face_t;
|
||||
typedef typename src_trimesh_t::FaceIterator src_face_i;
|
||||
typedef typename src_trimesh_t::VertContainer src_vertex_container_t;
|
||||
|
||||
typedef vcg::tri::Allocator<src_trimesh_t> src_mesh_allocator_t;
|
||||
typedef typename src_mesh_allocator_t :: template PointerUpdater<typename src_trimesh_t::VertexPointer> src_pointer_updater_t;
|
||||
|
||||
if ((src.vn <= 0) || (src.fn <= 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
src_pointer_updater_t pt_upd;
|
||||
src_vertex_i vi = src_mesh_allocator_t::AddVertices(src, 1, pt_upd);
|
||||
src_vertex_t * vtx = &(*vi);
|
||||
src_vertex_t * vtxbase = &(src.vert[0]);
|
||||
|
||||
const size_t vertex_count = src.vert.size();
|
||||
const size_t vertex_pool_size = vertex_count;
|
||||
|
||||
std::vector<int> vloc;
|
||||
vloc.reserve(vertex_pool_size);
|
||||
vloc.resize(vertex_count, -2);
|
||||
|
||||
int vcount = int(src.vert.size());
|
||||
int idx = 0;
|
||||
|
||||
for (src_face_i it=src.face.begin(); it!=src.face.end(); ++it)
|
||||
{
|
||||
src_face_t & f = (*it);
|
||||
if (f.IsD()) continue;
|
||||
|
||||
for (int k=0; k<3; ++k)
|
||||
{
|
||||
idx = (f.cV(k) - vtxbase);
|
||||
v_extract(src, f, k, src, *vtx);
|
||||
|
||||
if (vloc[idx] == -2)
|
||||
{
|
||||
vloc[idx] = -1;
|
||||
src.vert[idx].ImportData(*vtx);
|
||||
}
|
||||
else
|
||||
{
|
||||
int vidx = idx;
|
||||
do
|
||||
{
|
||||
if (v_compare(src, src.vert[vidx], *vtx)) break;
|
||||
vidx = vloc[vidx];
|
||||
} while (vidx >= 0);
|
||||
|
||||
if (vidx < 0)
|
||||
{
|
||||
vloc.push_back(vloc[idx]);
|
||||
vloc[idx] = vcount;
|
||||
|
||||
vi = src_mesh_allocator_t::AddVertices(src, 1, pt_upd);
|
||||
pt_upd.Update(vtx);
|
||||
pt_upd.Update(vtxbase);
|
||||
|
||||
(*vi).ImportData(*vtx);
|
||||
|
||||
idx = vcount;
|
||||
vcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = vidx;
|
||||
}
|
||||
}
|
||||
|
||||
f.V(k) = &(src.vert[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
src_mesh_allocator_t::DeleteVertex(src, *vtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// out-of-place version
|
||||
template <typename src_trimesh_t, typename dst_trimesh_t, typename extract_wedge_attribs_t, typename compare_vertex_attribs_t, typename copy_vertex_t>
|
||||
static inline bool SplitVertex(const src_trimesh_t & src, dst_trimesh_t & dst, extract_wedge_attribs_t & v_extract, compare_vertex_attribs_t & v_compare, copy_vertex_t & v_copy)
|
||||
{
|
||||
typedef typename src_trimesh_t::VertexType src_vertex_t;
|
||||
typedef typename src_trimesh_t::FaceType src_face_t;
|
||||
typedef typename src_trimesh_t::ConstFaceIterator src_face_ci;
|
||||
|
||||
typedef typename dst_trimesh_t::VertContainer dst_vertex_container_t;
|
||||
typedef typename dst_trimesh_t::VertexType dst_vertex_t;
|
||||
typedef typename dst_trimesh_t::VertexIterator dst_vertex_i;
|
||||
typedef typename dst_trimesh_t::FaceType dst_face_t;
|
||||
typedef typename dst_trimesh_t::FaceIterator dst_face_i;
|
||||
|
||||
typedef vcg::tri::Allocator<dst_trimesh_t> dst_mesh_allocator_t;
|
||||
|
||||
/* GCC gets in troubles and need some hints ("template") to parse the following line */
|
||||
typedef typename dst_mesh_allocator_t :: template PointerUpdater<typename dst_trimesh_t::VertexPointer> dst_pointer_updater_t;
|
||||
|
||||
if (reinterpret_cast<const void *>(&src) == reinterpret_cast<const void *>(&dst))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dst.Clear();
|
||||
|
||||
if ((src.vn <= 0) || (src.fn <= 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_t vertex_count = src.vert.size();
|
||||
const size_t vertex_pool_size = vertex_count;
|
||||
|
||||
const src_vertex_t * vtxbase = &(src.vert[0]);
|
||||
|
||||
std::vector<int> vloc;
|
||||
vloc.reserve(vertex_pool_size);
|
||||
vloc.resize(vertex_count, -2);
|
||||
|
||||
dst_vertex_i vv;
|
||||
dst_pointer_updater_t pt_upd;
|
||||
pt_upd.preventUpdateFlag = true;
|
||||
dst_mesh_allocator_t::AddVertices(dst, 1 + int(vertex_count), pt_upd);
|
||||
dst_vertex_t * vtx = &(dst.vert[0]);
|
||||
|
||||
dst_face_i fbase = dst_mesh_allocator_t::AddFaces(dst, src.fn);
|
||||
dst_face_i fi = fbase;
|
||||
|
||||
int vcount = int(dst.vert.size());
|
||||
int idx = 0;
|
||||
|
||||
for (src_face_ci it=src.face.begin(); it!=src.face.end(); ++it)
|
||||
{
|
||||
const src_face_t & wf = (*it);
|
||||
if (wf.IsD()) continue;
|
||||
|
||||
dst_face_t & vf = (*fi);
|
||||
|
||||
for (int k=0; k<3; ++k)
|
||||
{
|
||||
idx = (wf.cV(k) - vtxbase);
|
||||
|
||||
v_extract(src, wf, k, dst, *vtx);
|
||||
|
||||
if (vloc[idx] == -2)
|
||||
{
|
||||
vloc[idx] = -1;
|
||||
v_copy(dst, *vtx, dst.vert[idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int vidx = idx;
|
||||
do
|
||||
{
|
||||
if (v_compare(dst, dst.vert[vidx], *vtx)) break;
|
||||
vidx = vloc[vidx];
|
||||
} while (vidx >= 0);
|
||||
|
||||
if (vidx < 0)
|
||||
{
|
||||
vloc.push_back(vloc[idx]);
|
||||
vloc[idx] = vcount;
|
||||
|
||||
vv = dst_mesh_allocator_t::AddVertices(dst, 1, pt_upd);
|
||||
pt_upd.Update(vtx);
|
||||
v_copy(dst, *vtx, *vv);
|
||||
|
||||
idx = vcount;
|
||||
vcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = vidx;
|
||||
}
|
||||
}
|
||||
|
||||
vf.V(k) = reinterpret_cast<dst_vertex_t *>(idx);
|
||||
}
|
||||
|
||||
fi++;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> tmp;
|
||||
vloc.swap(tmp);
|
||||
}
|
||||
|
||||
dst_vertex_t * vstart = &(dst.vert[0]);
|
||||
|
||||
for (dst_face_i it=fbase; it!=dst.face.end(); ++it)
|
||||
{
|
||||
dst_face_t & vf = (*it);
|
||||
public:
|
||||
|
||||
typedef AttributeSeam ThisType;
|
||||
|
||||
enum ASMask
|
||||
{
|
||||
POSITION_PER_VERTEX = (1 << 0),
|
||||
|
||||
NORMAL_PER_VERTEX = (1 << 1),
|
||||
NORMAL_PER_WEDGE = (1 << 2),
|
||||
NORMAL_PER_FACE = (1 << 3),
|
||||
|
||||
COLOR_PER_VERTEX = (1 << 4),
|
||||
COLOR_PER_WEDGE = (1 << 5),
|
||||
COLOR_PER_FACE = (1 << 6),
|
||||
|
||||
TEXCOORD_PER_VERTEX = (1 << 7),
|
||||
TEXCOORD_PER_WEDGE = (1 << 8)
|
||||
};
|
||||
|
||||
template <typename src_trimesh_t, typename dst_trimesh_t>
|
||||
struct ASExtract
|
||||
{
|
||||
const unsigned int mask;
|
||||
|
||||
ASExtract(unsigned int vmask = 0) : mask(vmask)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
void operator () (const src_trimesh_t & sm, const typename src_trimesh_t::FaceType & f, int k, const dst_trimesh_t & dm, typename dst_trimesh_t::VertexType & v) const
|
||||
{
|
||||
(void)sm;
|
||||
(void)dm;
|
||||
|
||||
const unsigned int m = this->mask;
|
||||
const typename src_trimesh_t::VertexType & u = *(f.cV(k));
|
||||
|
||||
if ((m & AttributeSeam::POSITION_PER_VERTEX) != 0) v.P() = f.cP (k);
|
||||
|
||||
if ((m & AttributeSeam::NORMAL_PER_VERTEX) != 0) v.N() = u.cN ( );
|
||||
if ((m & AttributeSeam::NORMAL_PER_WEDGE) != 0) v.N() = f.cWN(k);
|
||||
if ((m & AttributeSeam::NORMAL_PER_FACE) != 0) v.N() = f.cN ( );
|
||||
|
||||
if ((m & AttributeSeam::COLOR_PER_VERTEX) != 0) v.C() = u.cC ( );
|
||||
if ((m & AttributeSeam::COLOR_PER_WEDGE) != 0) v.C() = f.cWC(k);
|
||||
if ((m & AttributeSeam::COLOR_PER_FACE) != 0) v.C() = f.cC ( );
|
||||
|
||||
if ((m & AttributeSeam::TEXCOORD_PER_VERTEX) != 0) v.T() = u.cT ( );
|
||||
if ((m & AttributeSeam::TEXCOORD_PER_WEDGE) != 0) v.T() = f.cWT(k);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename dst_trimesh_t>
|
||||
struct ASCompare
|
||||
{
|
||||
const unsigned int mask;
|
||||
|
||||
ASCompare(unsigned int vmask = 0) : mask(vmask)
|
||||
{
|
||||
;
|
||||
}
|
||||
|
||||
bool operator () (const dst_trimesh_t & sm, const typename dst_trimesh_t::VertexType & u, const typename dst_trimesh_t::VertexType & v) const
|
||||
{
|
||||
(void)sm;
|
||||
|
||||
const unsigned int m = this->mask;
|
||||
|
||||
/*
|
||||
if ((m & (AttributeSeam::POSITION_PER_VERTEX)) != 0)
|
||||
{
|
||||
if (u.cP() != v.cP()) return false;
|
||||
}
|
||||
*/
|
||||
|
||||
if ((m & (AttributeSeam::NORMAL_PER_VERTEX | AttributeSeam::NORMAL_PER_WEDGE | AttributeSeam::NORMAL_PER_FACE)) != 0)
|
||||
{
|
||||
if (u.cN() != v.cN()) return false;
|
||||
}
|
||||
|
||||
if ((m & (AttributeSeam::COLOR_PER_VERTEX | AttributeSeam::COLOR_PER_WEDGE | AttributeSeam::COLOR_PER_FACE)) != 0)
|
||||
{
|
||||
if (u.cC() != v.cC()) return false;
|
||||
}
|
||||
|
||||
if ((m & (AttributeSeam::TEXCOORD_PER_VERTEX | AttributeSeam::TEXCOORD_PER_WEDGE)) != 0)
|
||||
{
|
||||
if (u.cT() != v.cT()) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
// in-place version
|
||||
template <typename src_trimesh_t, typename extract_wedge_attribs_t, typename compare_vertex_attribs_t>
|
||||
static inline bool SplitVertex(src_trimesh_t & src, extract_wedge_attribs_t v_extract, compare_vertex_attribs_t & v_compare)
|
||||
{
|
||||
typedef typename src_trimesh_t::VertexType src_vertex_t;
|
||||
typedef typename src_trimesh_t::VertexIterator src_vertex_i;
|
||||
typedef typename src_trimesh_t::FaceType src_face_t;
|
||||
typedef typename src_trimesh_t::FaceIterator src_face_i;
|
||||
typedef typename src_trimesh_t::VertContainer src_vertex_container_t;
|
||||
|
||||
typedef vcg::tri::Allocator<src_trimesh_t> src_mesh_allocator_t;
|
||||
typedef typename src_mesh_allocator_t :: template PointerUpdater<typename src_trimesh_t::VertexPointer> src_pointer_updater_t;
|
||||
|
||||
if ((src.vn <= 0) || (src.fn <= 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
src_pointer_updater_t pt_upd;
|
||||
src_vertex_i vi = src_mesh_allocator_t::AddVertices(src, 1, pt_upd);
|
||||
src_vertex_t * vtx = &(*vi);
|
||||
src_vertex_t * vtxbase = &(src.vert[0]);
|
||||
|
||||
const size_t vertex_count = src.vert.size();
|
||||
const size_t vertex_pool_size = vertex_count;
|
||||
|
||||
std::vector<int> vloc;
|
||||
vloc.reserve(vertex_pool_size);
|
||||
vloc.resize(vertex_count, -2);
|
||||
|
||||
int vcount = int(src.vert.size());
|
||||
int idx = 0;
|
||||
|
||||
for (src_face_i it=src.face.begin(); it!=src.face.end(); ++it)
|
||||
{
|
||||
src_face_t & f = (*it);
|
||||
if (f.IsD()) continue;
|
||||
|
||||
for (int k=0; k<3; ++k)
|
||||
{
|
||||
idx = (f.cV(k) - vtxbase);
|
||||
v_extract(src, f, k, src, *vtx);
|
||||
|
||||
if (vloc[idx] == -2)
|
||||
{
|
||||
vloc[idx] = -1;
|
||||
src.vert[idx].ImportData(*vtx);
|
||||
}
|
||||
else
|
||||
{
|
||||
int vidx = idx;
|
||||
do
|
||||
{
|
||||
if (v_compare(src, src.vert[vidx], *vtx)) break;
|
||||
vidx = vloc[vidx];
|
||||
} while (vidx >= 0);
|
||||
|
||||
if (vidx < 0)
|
||||
{
|
||||
vloc.push_back(vloc[idx]);
|
||||
vloc[idx] = vcount;
|
||||
|
||||
vi = src_mesh_allocator_t::AddVertices(src, 1, pt_upd);
|
||||
pt_upd.Update(vtx);
|
||||
pt_upd.Update(vtxbase);
|
||||
|
||||
(*vi).ImportData(*vtx);
|
||||
|
||||
idx = vcount;
|
||||
vcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = vidx;
|
||||
}
|
||||
}
|
||||
|
||||
f.V(k) = &(src.vert[idx]);
|
||||
}
|
||||
}
|
||||
|
||||
src_mesh_allocator_t::DeleteVertex(src, *vtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// out-of-place version
|
||||
template <typename src_trimesh_t, typename dst_trimesh_t, typename extract_wedge_attribs_t, typename compare_vertex_attribs_t, typename copy_vertex_t>
|
||||
static inline bool SplitVertex(const src_trimesh_t & src, dst_trimesh_t & dst, extract_wedge_attribs_t & v_extract, compare_vertex_attribs_t & v_compare, copy_vertex_t & v_copy)
|
||||
{
|
||||
typedef typename src_trimesh_t::VertexType src_vertex_t;
|
||||
typedef typename src_trimesh_t::FaceType src_face_t;
|
||||
typedef typename src_trimesh_t::ConstFaceIterator src_face_ci;
|
||||
|
||||
typedef typename dst_trimesh_t::VertContainer dst_vertex_container_t;
|
||||
typedef typename dst_trimesh_t::VertexType dst_vertex_t;
|
||||
typedef typename dst_trimesh_t::VertexIterator dst_vertex_i;
|
||||
typedef typename dst_trimesh_t::FaceType dst_face_t;
|
||||
typedef typename dst_trimesh_t::FaceIterator dst_face_i;
|
||||
|
||||
typedef vcg::tri::Allocator<dst_trimesh_t> dst_mesh_allocator_t;
|
||||
|
||||
/* GCC gets in troubles and need some hints ("template") to parse the following line */
|
||||
typedef typename dst_mesh_allocator_t :: template PointerUpdater<typename dst_trimesh_t::VertexPointer> dst_pointer_updater_t;
|
||||
|
||||
if (reinterpret_cast<const void *>(&src) == reinterpret_cast<const void *>(&dst))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
dst.Clear();
|
||||
|
||||
if ((src.vn <= 0) || (src.fn <= 0))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const size_t vertex_count = src.vert.size();
|
||||
const size_t vertex_pool_size = vertex_count;
|
||||
|
||||
const src_vertex_t * vtxbase = &(src.vert[0]);
|
||||
|
||||
std::vector<int> vloc;
|
||||
vloc.reserve(vertex_pool_size);
|
||||
vloc.resize(vertex_count, -2);
|
||||
|
||||
dst_vertex_i vv;
|
||||
dst_pointer_updater_t pt_upd;
|
||||
pt_upd.preventUpdateFlag = true;
|
||||
dst_mesh_allocator_t::AddVertices(dst, 1 + int(vertex_count), pt_upd);
|
||||
dst_vertex_t * vtx = &(dst.vert[0]);
|
||||
|
||||
dst_face_i fbase = dst_mesh_allocator_t::AddFaces(dst, src.fn);
|
||||
dst_face_i fi = fbase;
|
||||
|
||||
int vcount = int(dst.vert.size());
|
||||
int idx = 0;
|
||||
|
||||
for (src_face_ci it=src.face.begin(); it!=src.face.end(); ++it)
|
||||
{
|
||||
const src_face_t & wf = (*it);
|
||||
if (wf.IsD()) continue;
|
||||
|
||||
dst_face_t & vf = (*fi);
|
||||
|
||||
for (int k=0; k<3; ++k)
|
||||
{
|
||||
idx = (wf.cV(k) - vtxbase);
|
||||
|
||||
v_extract(src, wf, k, dst, *vtx);
|
||||
|
||||
if (vloc[idx] == -2)
|
||||
{
|
||||
vloc[idx] = -1;
|
||||
v_copy(dst, *vtx, dst.vert[idx]);
|
||||
}
|
||||
else
|
||||
{
|
||||
int vidx = idx;
|
||||
do
|
||||
{
|
||||
if (v_compare(dst, dst.vert[vidx], *vtx)) break;
|
||||
vidx = vloc[vidx];
|
||||
} while (vidx >= 0);
|
||||
|
||||
if (vidx < 0)
|
||||
{
|
||||
vloc.push_back(vloc[idx]);
|
||||
vloc[idx] = vcount;
|
||||
|
||||
vv = dst_mesh_allocator_t::AddVertices(dst, 1, pt_upd);
|
||||
pt_upd.Update(vtx);
|
||||
v_copy(dst, *vtx, *vv);
|
||||
|
||||
idx = vcount;
|
||||
vcount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = vidx;
|
||||
}
|
||||
}
|
||||
|
||||
vf.V(k) = reinterpret_cast<dst_vertex_t *>(idx);
|
||||
}
|
||||
|
||||
fi++;
|
||||
}
|
||||
|
||||
{
|
||||
std::vector<int> tmp;
|
||||
vloc.swap(tmp);
|
||||
}
|
||||
|
||||
dst_vertex_t * vstart = &(dst.vert[0]);
|
||||
|
||||
for (dst_face_i it=fbase; it!=dst.face.end(); ++it)
|
||||
{
|
||||
dst_face_t & vf = (*it);
|
||||
|
||||
vf.V(0) = vstart + reinterpret_cast<const int>(vf.V(0));
|
||||
vf.V(1) = vstart + reinterpret_cast<const int>(vf.V(1));
|
||||
vf.V(2) = vstart + reinterpret_cast<const int>(vf.V(2));
|
||||
}
|
||||
|
||||
dst_mesh_allocator_t::DeleteVertex(dst, *vtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
vf.V(0) = vstart + reinterpret_cast<const int>(vf.V(0));
|
||||
vf.V(1) = vstart + reinterpret_cast<const int>(vf.V(1));
|
||||
vf.V(2) = vstart + reinterpret_cast<const int>(vf.V(2));
|
||||
}
|
||||
|
||||
dst_mesh_allocator_t::DeleteVertex(dst, *vtx);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace tri
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <vcg/complex/algorithms/bitquad_support.h>
|
||||
#include <vcg/complex/allocate.h>
|
||||
|
||||
/** BIT-QUAD creation support:
|
||||
a collection of methods that,
|
||||
|
@ -347,11 +346,11 @@ static bool IsTriOnly(const MeshType &m){
|
|||
/* returns true if mesh is a pure quad-mesh. */
|
||||
static bool IsQuadOnly(const MeshType &m){
|
||||
for (ConstFaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) if (!fi->IsD()) {
|
||||
int count = 0;
|
||||
if (fi->IsF(0)) count++;
|
||||
if (fi->IsF(1)) count++;
|
||||
if (fi->IsF(2)) count++;
|
||||
if (count!=1) return false;
|
||||
int count = 0;
|
||||
if (fi->IsF(0)) count++;
|
||||
if (fi->IsF(1)) count++;
|
||||
if (fi->IsF(2)) count++;
|
||||
if (count!=1) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -359,11 +358,11 @@ static bool IsQuadOnly(const MeshType &m){
|
|||
/* returns true if mesh has only tris and quads (no penta etc) */
|
||||
static bool IsTriQuadOnly(const MeshType &m){
|
||||
for (ConstFaceIterator fi = m.face.begin(); fi!=m.face.end(); fi++) if (!fi->IsD()) {
|
||||
int count = 0;
|
||||
if (fi->IsF(0)) count++;
|
||||
if (fi->IsF(1)) count++;
|
||||
if (fi->IsF(2)) count++;
|
||||
if (count>1) return false;
|
||||
int count = 0;
|
||||
if (fi->IsF(0)) count++;
|
||||
if (fi->IsF(1)) count++;
|
||||
if (fi->IsF(2)) count++;
|
||||
if (count>1) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -443,22 +442,22 @@ static void MakePureByRefine(MeshType &m){
|
|||
assert(nvi!=m.vert.end());
|
||||
VertexType *nv = &*nvi; nvi++;
|
||||
//*nv = *fi->V0( 0 ); // lazy: copy everything from the old vertex
|
||||
nv->ImportData(*(fi->V0( 0 ))); // lazy: copy everything from the old vertex
|
||||
nv->ImportData(*(fi->V0( 0 ))); // lazy: copy everything from the old vertex
|
||||
|
||||
nv->P() = ( fi->V(0)->P() + fi->V(1)->P() + fi->V(2)->P() ) /3.0;
|
||||
FaceType *fa = &*fi;
|
||||
FaceType *fb = &*nfi; nfi++;
|
||||
FaceType *fc = &*nfi; nfi++;
|
||||
|
||||
fb->ImportData(*fa); CopyTopology(fb,fa);
|
||||
fc->ImportData(*fa); CopyTopology(fc,fa);
|
||||
fb->ImportData(*fa); CopyTopology(fb,fa);
|
||||
fc->ImportData(*fa); CopyTopology(fc,fa);
|
||||
|
||||
fa->V(0) = nv;
|
||||
fb->V(1) = nv;
|
||||
fc->V(2) = nv;
|
||||
|
||||
fb->FFp(2)=fa->FFp(2); fb->FFi(2)=fa->FFi(2);
|
||||
fc->FFp(0)=fa->FFp(0); fc->FFi(0)=fa->FFi(0);
|
||||
fc->FFp(0)=fa->FFp(0); fc->FFi(0)=fa->FFi(0);
|
||||
|
||||
assert( fa->FFp(1)->FFp(fa->FFi(1)) == fa );
|
||||
/* */fb->FFp(2)->FFp(fb->FFi(2)) = fb;
|
||||
|
@ -517,7 +516,7 @@ static void MakePureByRefine(MeshType &m){
|
|||
assert(nvi!=m.vert.end());
|
||||
VertexType *nv = &*nvi; nvi++;
|
||||
// *nv = * fa->V0( ea2 );
|
||||
nv->ImportData(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex
|
||||
nv->ImportData(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex
|
||||
//nv->P() = ( fa->V(ea2)->P() + fa->V(ea0)->P() ) /2.0;
|
||||
Interpolator::Apply(*(fa->V(ea2)),*(fa->V(ea0)),0.5,*nv);
|
||||
// split faces: add 2 faces (one per side)
|
||||
|
@ -526,8 +525,8 @@ static void MakePureByRefine(MeshType &m){
|
|||
assert(nfi!=m.face.end());
|
||||
FaceType *fd = &*nfi; nfi++;
|
||||
|
||||
fc->ImportData(*fa ); CopyTopology(fc,fa); // lazy: copy everything from the old vertex
|
||||
fd->ImportData(*fb ); CopyTopology(fd,fb);// lazy: copy everything from the old vertex
|
||||
fc->ImportData(*fa ); CopyTopology(fc,fa); // lazy: copy everything from the old vertex
|
||||
fd->ImportData(*fb ); CopyTopology(fd,fb);// lazy: copy everything from the old vertex
|
||||
|
||||
fa->V(ea2) = fc->V(ea0) =
|
||||
fb->V(eb2) = fd->V(eb0) = nv ;
|
||||
|
@ -621,13 +620,13 @@ static void MakePureByRefine(MeshType &m){
|
|||
// create new vert in center of faux edge
|
||||
VertexType *nv = &*nvi; nvi++;
|
||||
//*nv = * fa->V0( ea2 );
|
||||
nv->ImportData(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex
|
||||
nv->ImportData(*(fa->V0( ea2 ) )); // lazy: copy everything from the old vertex
|
||||
nv->P() = ( fa->V(ea2)->P() + fa->V(ea0)->P() ) /2.0;
|
||||
Interpolator::Apply(*(fa->V(ea2)),*(fa->V(ea0)),0.5,*nv);
|
||||
// split face: add 1 face
|
||||
FaceType *fc = &*nfi; nfi++;
|
||||
|
||||
fc->ImportData(*fa);CopyTopology(fc,fa); // lazy: copy everything from the old vertex
|
||||
fc->ImportData(*fa);CopyTopology(fc,fa); // lazy: copy everything from the old vertex
|
||||
|
||||
fa->V(ea2) = fc->V(ea0) = nv ;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#ifndef VCG_BITQUAD_SUPPORT
|
||||
#define VCG_BITQUAD_SUPPORT
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <vcg/simplex/face/jumping_pos.h>
|
||||
#include <vcg/simplex/face/topology.h>
|
||||
#include <vcg/space/planar_polygon_tessellation.h>
|
||||
|
@ -811,8 +809,8 @@ static bool CollapseDiag(FaceType &f, ScalarType interpol, MeshType& m, Pos* aff
|
|||
pf = t;
|
||||
} while ((pf!=fb));
|
||||
|
||||
pi = fauxb;
|
||||
pf = fb;
|
||||
pi = fauxb;
|
||||
pf = fb;
|
||||
|
||||
do {
|
||||
pf->V(pi) = va;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -32,9 +32,9 @@ class FrontEdge {
|
|||
}
|
||||
|
||||
bool operator==(const FrontEdge& f) const
|
||||
{
|
||||
return ((v0 == f.v0) && (v1 == f.v1) && (v2 == f.v2) );
|
||||
}
|
||||
{
|
||||
return ((v0 == f.v0) && (v1 == f.v1) && (v2 == f.v2) );
|
||||
}
|
||||
};
|
||||
|
||||
template <class MESH> class AdvancingFront {
|
||||
|
@ -79,18 +79,18 @@ template <class MESH> class AdvancingFront {
|
|||
void BuildMesh(CallBackPos call = NULL, int interval = 512)
|
||||
{
|
||||
float finalfacesext = mesh.vert.size() * 2.0f;
|
||||
if(call) call(0, "Advancing front");
|
||||
while(1) {
|
||||
if(call) call(0, "Advancing front");
|
||||
while(1) {
|
||||
|
||||
for(int i = 0; i < interval; i++) {
|
||||
if(!front.size() && !SeedFace()) return;
|
||||
AddFace();
|
||||
if(call)
|
||||
{
|
||||
float rap = float(mesh.face.size()) / finalfacesext;
|
||||
int perc = (int) (100.0f * rap);
|
||||
(*call)(perc,"Adding Faces");
|
||||
}
|
||||
if(call)
|
||||
{
|
||||
float rap = float(mesh.face.size()) / finalfacesext;
|
||||
int perc = (int) (100.0f * rap);
|
||||
(*call)(perc,"Adding Faces");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -191,8 +191,8 @@ public:
|
|||
assert(nb[v0] < 10 && nb[v1] < 10);
|
||||
|
||||
ResultIterator touch;
|
||||
touch.first = FRONT;
|
||||
touch.second = front.end();
|
||||
touch.first = FRONT;
|
||||
touch.second = front.end();
|
||||
int v2 = Place(current, touch);
|
||||
|
||||
if(v2 == -1) {
|
||||
|
@ -202,10 +202,10 @@ public:
|
|||
|
||||
assert(v2 != v0 && v2 != v1);
|
||||
|
||||
if ((touch.first == FRONT) && (touch.second != front.end()) ||
|
||||
(touch.first == DEADS) && (touch.second != deads.end()))
|
||||
if ( ( (touch.first == FRONT) && (touch.second != front.end()) ) ||
|
||||
( (touch.first == DEADS) && (touch.second != deads.end()) ) )
|
||||
|
||||
{
|
||||
{
|
||||
//check for orientation and manifoldness
|
||||
|
||||
//touch == current.previous?
|
||||
|
@ -307,9 +307,9 @@ public:
|
|||
|
||||
|
||||
}
|
||||
else if ((touch.first == FRONT) && (touch.second == front.end()) ||
|
||||
(touch.first == DEADS) && (touch.second == deads.end()))
|
||||
{
|
||||
else if (((touch.first == FRONT) && (touch.second == front.end())) ||
|
||||
((touch.first == DEADS) && (touch.second == deads.end())) )
|
||||
{
|
||||
// assert(CheckEdge(v0, v2));
|
||||
// assert(CheckEdge(v2, v1));
|
||||
/* adding a new vertex
|
||||
|
@ -425,15 +425,15 @@ protected:
|
|||
void KillEdge(std::list<FrontEdge>::iterator e)
|
||||
{
|
||||
if (e->active)
|
||||
{
|
||||
(*e).active = false;
|
||||
//std::list<FrontEdge>::iterator res = std::find(front.begin(),front.end(),e);
|
||||
FrontEdge tmp = *e;
|
||||
deads.splice(deads.end(), front, e);
|
||||
std::list<FrontEdge>::iterator newe = std::find(deads.begin(),deads.end(),tmp);
|
||||
tmp.previous->next = newe;
|
||||
tmp.next->previous = newe;
|
||||
}
|
||||
{
|
||||
(*e).active = false;
|
||||
//std::list<FrontEdge>::iterator res = std::find(front.begin(),front.end(),e);
|
||||
FrontEdge tmp = *e;
|
||||
deads.splice(deads.end(), front, e);
|
||||
std::list<FrontEdge>::iterator newe = std::find(deads.begin(),deads.end(),tmp);
|
||||
tmp.previous->next = newe;
|
||||
tmp.next->previous = newe;
|
||||
}
|
||||
}
|
||||
|
||||
void Erase(std::list<FrontEdge>::iterator e) {
|
||||
|
@ -518,27 +518,27 @@ template <class MESH> class AdvancingTest: public AdvancingFront<MESH> {
|
|||
|
||||
int vn = this->mesh.vert.size();
|
||||
for(int i = 0; i < this->mesh.vert.size(); i++)
|
||||
{
|
||||
{
|
||||
if((this->mesh.vert[i].P() - point).Norm() < 0.1)
|
||||
{
|
||||
vn = i;
|
||||
//find the border
|
||||
assert(this->mesh.vert[i].IsB());
|
||||
for(std::list<FrontEdge>::iterator k = this->front.begin(); k != this->front.end(); k++)
|
||||
if((*k).v0 == i)
|
||||
{
|
||||
{
|
||||
vn = i;
|
||||
//find the border
|
||||
assert(this->mesh.vert[i].IsB());
|
||||
for(std::list<FrontEdge>::iterator k = this->front.begin(); k != this->front.end(); k++)
|
||||
if((*k).v0 == i)
|
||||
{
|
||||
touch.first = AdvancingFront<MESH>::FRONT;
|
||||
touch.second = k;
|
||||
}
|
||||
touch.second = k;
|
||||
}
|
||||
|
||||
for(std::list<FrontEdge>::iterator k = this->deads.begin(); k != this->deads.end(); k++)
|
||||
if((*k).v0 == i)
|
||||
if((*k).v0 == i)
|
||||
{
|
||||
for(std::list<FrontEdge>::iterator k = this->deads.begin(); k != this->deads.end(); k++)
|
||||
if((*k).v0 == i)
|
||||
if((*k).v0 == i)
|
||||
{
|
||||
touch.first = AdvancingFront<MESH>::FRONT;
|
||||
touch.second = k;
|
||||
}
|
||||
break;
|
||||
touch.second = k;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(vn == this->mesh.vert.size()) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -24,10 +24,6 @@
|
|||
#ifndef __VCGLIB_APPEND
|
||||
#define __VCGLIB_APPEND
|
||||
|
||||
#include <vcg/complex/algorithms/update/flag.h>
|
||||
#include <vcg/complex/algorithms/update/selection.h>
|
||||
#include <set>
|
||||
|
||||
namespace vcg {
|
||||
namespace tri {
|
||||
/** \ingroup trimesh */
|
||||
|
@ -68,7 +64,7 @@ public:
|
|||
typedef typename ConstMeshRight::FacePointer FacePointerRight;
|
||||
|
||||
struct Remap{
|
||||
std::vector<int> vert,face,edge, hedge;
|
||||
std::vector<int> vert,face,edge, hedge;
|
||||
};
|
||||
|
||||
static void ImportVertexAdj(MeshLeft &ml, ConstMeshRight &mr, VertexLeft &vl, VertexRight &vr, Remap &remap ){
|
||||
|
@ -316,60 +312,60 @@ static void Mesh(MeshLeft& ml, ConstMeshRight& mr, const bool selected = false,
|
|||
ImportHEdgeAdj(ml,mr,ml.hedge[remap.hedge[Index(mr,*hi)]],*hi,remap,selected);
|
||||
}
|
||||
|
||||
// phase 3.
|
||||
// take care of other per mesh data: textures, attributes
|
||||
// phase 3.
|
||||
// take care of other per mesh data: textures, attributes
|
||||
|
||||
// At the end concatenate the vector with texture names.
|
||||
ml.textures.insert(ml.textures.end(),mr.textures.begin(),mr.textures.end());
|
||||
// At the end concatenate the vector with texture names.
|
||||
ml.textures.insert(ml.textures.end(),mr.textures.begin(),mr.textures.end());
|
||||
|
||||
// Attributes. Copy only those attributes that are present in both meshes
|
||||
// Two attributes in different meshes are considered the same if they have the same
|
||||
// name and the same type. This may be deceiving because they could in fact have
|
||||
// different semantic, but this is up to the developer.
|
||||
// If the left mesh has attributes that are not in the right mesh, their values for the elements
|
||||
// of the right mesh will be uninitialized
|
||||
// Attributes. Copy only those attributes that are present in both meshes
|
||||
// Two attributes in different meshes are considered the same if they have the same
|
||||
// name and the same type. This may be deceiving because they could in fact have
|
||||
// different semantic, but this is up to the developer.
|
||||
// If the left mesh has attributes that are not in the right mesh, their values for the elements
|
||||
// of the right mesh will be uninitialized
|
||||
|
||||
unsigned int id_r;
|
||||
typename std::set< PointerToAttribute >::iterator al, ar;
|
||||
unsigned int id_r;
|
||||
typename std::set< PointerToAttribute >::iterator al, ar;
|
||||
|
||||
// per vertex attributes
|
||||
for(al = ml.vert_attr.begin(); al != ml.vert_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.vert_attr.find(*al);
|
||||
if(ar!= mr.vert_attr.end()){
|
||||
id_r = 0;
|
||||
for(vi=mr.vert.begin();vi!=mr.vert.end();++vi,++id_r)
|
||||
if( !(*vi).IsD() && (!selected || (*vi).IsS()))
|
||||
memcpy((*al)._handle->At(remap.vert[Index(mr,*vi)]),(*ar)._handle->At(id_r),
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
// per vertex attributes
|
||||
for(al = ml.vert_attr.begin(); al != ml.vert_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.vert_attr.find(*al);
|
||||
if(ar!= mr.vert_attr.end()){
|
||||
id_r = 0;
|
||||
for(vi=mr.vert.begin();vi!=mr.vert.end();++vi,++id_r)
|
||||
if( !(*vi).IsD() && (!selected || (*vi).IsS()))
|
||||
memcpy((*al)._handle->At(remap.vert[Index(mr,*vi)]),(*ar)._handle->At(id_r),
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
|
||||
// per edge attributes
|
||||
for(al = ml.edge_attr.begin(); al != ml.edge_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.edge_attr.find(*al);
|
||||
if(ar!= mr.edge_attr.end()){
|
||||
id_r = 0;
|
||||
for(ei=mr.edge.begin();ei!=mr.edge.end();++ei,++id_r)
|
||||
if( !(*ei).IsD() && (!selected || (*ei).IsS()))
|
||||
// per edge attributes
|
||||
for(al = ml.edge_attr.begin(); al != ml.edge_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.edge_attr.find(*al);
|
||||
if(ar!= mr.edge_attr.end()){
|
||||
id_r = 0;
|
||||
for(ei=mr.edge.begin();ei!=mr.edge.end();++ei,++id_r)
|
||||
if( !(*ei).IsD() && (!selected || (*ei).IsS()))
|
||||
memcpy((*al)._handle->At(remap.edge[Index(mr,*ei)]),(*ar)._handle->At(id_r),
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
|
||||
// per face attributes
|
||||
for(al = ml.face_attr.begin(); al != ml.face_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.face_attr.find(*al);
|
||||
if(ar!= mr.face_attr.end()){
|
||||
id_r = 0;
|
||||
for(fi=mr.face.begin();fi!=mr.face.end();++fi,++id_r)
|
||||
if( !(*fi).IsD() && (!selected || (*fi).IsS()))
|
||||
// per face attributes
|
||||
for(al = ml.face_attr.begin(); al != ml.face_attr.end(); ++al)
|
||||
if(!(*al)._name.empty()){
|
||||
ar = mr.face_attr.find(*al);
|
||||
if(ar!= mr.face_attr.end()){
|
||||
id_r = 0;
|
||||
for(fi=mr.face.begin();fi!=mr.face.end();++fi,++id_r)
|
||||
if( !(*fi).IsD() && (!selected || (*fi).IsS()))
|
||||
memcpy((*al)._handle->At(remap.face[Index(mr,*fi)]),(*ar)._handle->At(id_r),
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
(*al)._handle->SizeOf());
|
||||
}
|
||||
}
|
||||
|
||||
// per mesh attributes
|
||||
// if both ml and mr have an attribute with the same name, no action is done
|
||||
|
|
|
@ -21,21 +21,30 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __VCG_MESH
|
||||
#ifndef __VCG_MESH_H
|
||||
#define __VCG_MESH_H
|
||||
#define __VCG_MESH
|
||||
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <exception>
|
||||
|
||||
#include <stack>
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <stdexcept>
|
||||
#include <limits>
|
||||
#include <set>
|
||||
#include <vcg/complex/exception.h>
|
||||
#include <vcg/container/simple_temporary_data.h>
|
||||
#include <vcg/complex/used_types.h>
|
||||
#include <vcg/complex/base.h>
|
||||
#include <vcg/complex/allocate.h>
|
||||
#include <vcg/complex/algorithms/update/flag.h>
|
||||
#include <vcg/complex/algorithms/update/selection.h>
|
||||
#include <vcg/complex/append.h>
|
||||
|
||||
#undef __VCG_MESH
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue