vcg::tri::Allocate<MESH>::Get*Attribute(m,name);
has CHANGED! Before it was returning a valid handle to the attribute IF it existed, otherwise the handle was invalid. Now it always returns a valid handle to the attribute, by creating the attribute name if it did not exist or returning the handle to it if it was already there. ALl the code using Get*Attribute has been changed accordingly.
This commit is contained in:
parent
512da45bf7
commit
8c998ccd11
|
@ -45,16 +45,16 @@ int main()
|
||||||
{
|
{
|
||||||
MyMesh m;
|
MyMesh m;
|
||||||
// add a per-vertex attribute with type float named "Irradiance"
|
// add a per-vertex attribute with type float named "Irradiance"
|
||||||
MyMesh::PerVertexAttributeHandle<float> named_hv = vcg::tri::Allocator<MyMesh>::AddPerVertexAttribute<float> (m,std::string("Irradiance"));
|
MyMesh::PerVertexAttributeHandle<float> named_hv = vcg::tri::Allocator<MyMesh>:: GetPerVertexAttribute<float> (m,std::string("Irradiance"));
|
||||||
|
|
||||||
// add a per-vertex attribute with type float named "Radiosity"
|
// add a per-vertex attribute with type float named "Radiosity"
|
||||||
vcg::tri::Allocator<MyMesh>::AddPerVertexAttribute<float> (m,std::string("Radiosity"));
|
vcg::tri::Allocator<MyMesh>:: GetPerVertexAttribute<float> (m,std::string("Radiosity"));
|
||||||
|
|
||||||
// add a per-vertex attribute with type bool and no name specified
|
// add a per-vertex attribute with type bool and no name specified
|
||||||
MyMesh::PerVertexAttributeHandle<bool> anon_hv = vcg::tri::Allocator<MyMesh>::AddPerVertexAttribute<bool> (m);
|
MyMesh::PerVertexAttributeHandle<bool> anon_hv = vcg::tri::Allocator<MyMesh>:: GetPerVertexAttribute<bool> (m);
|
||||||
|
|
||||||
// add a per-face attribute with type bool and no name specified
|
// add a per-face attribute with type bool and no name specified
|
||||||
MyMesh::PerFaceAttributeHandle<bool> anon_hf = vcg::tri::Allocator<MyMesh>::AddPerFaceAttribute<bool> (m);
|
MyMesh::PerFaceAttributeHandle<bool> anon_hf = vcg::tri::Allocator<MyMesh>:: GetPerFaceAttribute<bool> (m);
|
||||||
|
|
||||||
MyMesh::VertexIterator vi; int i = 0;
|
MyMesh::VertexIterator vi; int i = 0;
|
||||||
for(vi = m.vert.begin(); vi != m.vert.end(); ++vi,++i){
|
for(vi = m.vert.begin(); vi != m.vert.end(); ++vi,++i){
|
||||||
|
@ -64,14 +64,16 @@ int main()
|
||||||
named_hv[i] = 1.0f; // or an integer index
|
named_hv[i] = 1.0f; // or an integer index
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vcg::tri::Allocator<MyMesh>::ClearPerVertexAttribute<float>(m,named_hv);
|
||||||
|
|
||||||
// query if an attribute is present or not
|
// query if an attribute is present or not
|
||||||
bool hasRadiosity = vcg::tri::HasPerVertexAttribute(m,"Radiosity");
|
bool hasRadiosity = vcg::tri::HasPerVertexAttribute(m,"Radiosity");
|
||||||
|
|
||||||
// obtain another handle of a previously attribute
|
// obtain another handle of a previously attribute
|
||||||
MyMesh::PerVertexAttributeHandle<float> ret_hv = vcg::tri::Allocator<MyMesh>::GetPerVertexAttribute<float>(m,"Radiosity");
|
MyMesh::PerVertexAttributeHandle<float> ret_hv = vcg::tri::Allocator<MyMesh>:: FindPerVertexAttribute<float>(m,"Radiosity");
|
||||||
|
|
||||||
// you can also have PerMesh attributes
|
// you can also have PerMesh attributes
|
||||||
MyMesh::PerMeshAttributeHandle<int> hm = vcg::tri::Allocator<MyMesh>::AddPerMeshAttribute<int> (m,std::string("ADummyIntegerAttribute"));
|
MyMesh::PerMeshAttributeHandle<int> hm = vcg::tri::Allocator<MyMesh>:: GetPerMeshAttribute<int> (m,std::string("ADummyIntegerAttribute"));
|
||||||
|
|
||||||
// PerMesh attributes are accessed directly using the handle itself
|
// PerMesh attributes are accessed directly using the handle itself
|
||||||
hm() = 10;
|
hm() = 10;
|
||||||
|
|
|
@ -55,10 +55,10 @@ int main( int /*argc*/, char **/*argv*/ )
|
||||||
vcg::tri::io::ExporterOFF<MyMesh>::Save(m,"torus.off");
|
vcg::tri::io::ExporterOFF<MyMesh>::Save(m,"torus.off");
|
||||||
|
|
||||||
vcg::tri::UpdateTopology<MyMesh>::FaceFace(m);
|
vcg::tri::UpdateTopology<MyMesh>::FaceFace(m);
|
||||||
vcg::tri::UpdateCurvature<MyMesh>::PerVertex(m);
|
// vcg::tri::UpdateCurvature<MyMesh>::VertexCurvature(m);
|
||||||
vcg::tri::UpdateCurvature<MyMesh>::MeanAndGaussian(m);
|
vcg::tri::UpdateCurvature<MyMesh>::MeanAndGaussian(m);
|
||||||
vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirections(m);
|
vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirections(m);
|
||||||
vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirectionsNormalCycle(m);
|
//vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirectionsNormalCycles(m);
|
||||||
vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirectionsPCA(m,m.bbox.Diag()/100);
|
vcg::tri::UpdateCurvature<MyMesh>::PrincipalDirectionsPCA(m,m.bbox.Diag()/100);
|
||||||
|
|
||||||
vcg::tri::UpdateNormal<MyMesh>::PerVertexNormalized(m);
|
vcg::tri::UpdateNormal<MyMesh>::PerVertexNormalized(m);
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include <vcg/math/matrix.h>
|
#include <vcg/math/matrix.h>
|
||||||
#include <vcg/math/lin_algebra.h>
|
#include <vcg/math/lin_algebra.h>
|
||||||
#include <vcg/simplex/face/topology.h>
|
#include <vcg/simplex/face/topology.h>
|
||||||
#include <vcg/complex/algorithms/update/edges.h>
|
|
||||||
#include <vcg/complex/algorithms/update/normal.h>
|
#include <vcg/complex/algorithms/update/normal.h>
|
||||||
#include <vcg/complex/algorithms/update/topology.h>
|
#include <vcg/complex/algorithms/update/topology.h>
|
||||||
#include <vcg/complex/allocate.h>
|
#include <vcg/complex/allocate.h>
|
||||||
|
|
|
@ -711,8 +711,8 @@ public:
|
||||||
bool CrossDir1 = tri::HasPerFaceAttribute(mesh,"CrossDir1");
|
bool CrossDir1 = tri::HasPerFaceAttribute(mesh,"CrossDir1");
|
||||||
assert(CrossDir0);
|
assert(CrossDir0);
|
||||||
assert(CrossDir1);
|
assert(CrossDir1);
|
||||||
Fh0= tri::Allocator<MeshType> :: template GetPerFaceAttribute<CoordType>(mesh,std::string("CrossDir0"));
|
Fh0= tri::Allocator<MeshType> :: template GetPerFaceAttribute<CoordType>(mesh,std::string("CrossDir0"));
|
||||||
Fh1= tri::Allocator<MeshType> :: template GetPerFaceAttribute<CoordType>(mesh,std::string("CrossDir1"));
|
Fh1= tri::Allocator<MeshType> :: template GetPerFaceAttribute<CoordType>(mesh,std::string("CrossDir1"));
|
||||||
}
|
}
|
||||||
correct_fixed=_correct_fixed;
|
correct_fixed=_correct_fixed;
|
||||||
fieldScale=_fieldScale;
|
fieldScale=_fieldScale;
|
||||||
|
|
|
@ -187,7 +187,7 @@ static void FaceAssociateRegion(MeshType &m)
|
||||||
|
|
||||||
static int FaceSelectAssociateRegion(MeshType &m, VertexPointer vp)
|
static int FaceSelectAssociateRegion(MeshType &m, VertexPointer vp)
|
||||||
{
|
{
|
||||||
PerFacePointerHandle sources = tri::Allocator<MeshType>:: template GetPerFaceAttribute<VertexPointer> (m,"sources");
|
PerFacePointerHandle sources = tri::Allocator<MeshType>:: template FindPerFaceAttribute<VertexPointer> (m,"sources");
|
||||||
assert(tri::Allocator<MeshType>::IsValidHandle(m,sources));
|
assert(tri::Allocator<MeshType>::IsValidHandle(m,sources));
|
||||||
tri::UpdateSelection<MeshType>::Clear(m);
|
tri::UpdateSelection<MeshType>::Clear(m);
|
||||||
int selCnt=0;
|
int selCnt=0;
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#ifndef __VCGLIB_TRIALLOCATOR
|
#ifndef __VCGLIB_TRIALLOCATOR
|
||||||
#define __VCGLIB_TRIALLOCATOR
|
#define __VCGLIB_TRIALLOCATOR
|
||||||
|
|
||||||
#include <typeinfo>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
@ -914,7 +913,7 @@ public:
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>
|
typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>
|
||||||
AddPerVertexAttribute( MeshType & m, std::string name){
|
AddPerVertexAttribute( MeshType & m, std::string name){
|
||||||
PAIte i;
|
PAIte i;
|
||||||
PointerToAttribute h;
|
PointerToAttribute h;
|
||||||
h._name = name;
|
h._name = name;
|
||||||
|
@ -932,18 +931,35 @@ public:
|
||||||
return typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>(res.first->_handle,res.first->n_attr );
|
return typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>(res.first->_handle,res.first->n_attr );
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>
|
static typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>
|
||||||
AddPerVertexAttribute( MeshType & m){
|
AddPerVertexAttribute( MeshType & m){
|
||||||
return AddPerVertexAttribute<ATTR_TYPE>(m,std::string(""));
|
return AddPerVertexAttribute<ATTR_TYPE>(m,std::string(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief gives a handle to a per-vertex attribute with a given name and ATTR_TYPE
|
||||||
|
\returns a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it.
|
||||||
|
Otherwise return a hanlde to a newly created.
|
||||||
|
*/
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>
|
||||||
|
GetPerVertexAttribute( MeshType & m, std::string name = std::string("")){
|
||||||
|
typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE> h;
|
||||||
|
if(!name.empty()){
|
||||||
|
h = FindPerVertexAttribute<ATTR_TYPE>(m,name);
|
||||||
|
if(IsValidHandle(m,h))
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
return AddPerVertexAttribute<ATTR_TYPE>(m,name);
|
||||||
|
}
|
||||||
|
|
||||||
/*! \brief Try to retrieve an handle to an attribute with a given name and ATTR_TYPE
|
/*! \brief Try to retrieve an handle to an attribute with a given name and ATTR_TYPE
|
||||||
\returns a invalid handle if no attribute with that name and type exists.
|
\returns a invalid handle if no attribute with that name and type exists.
|
||||||
*/
|
*/
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>
|
static typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE>
|
||||||
GetPerVertexAttribute( MeshType & m, const std::string & name)
|
FindPerVertexAttribute( MeshType & m, const std::string & name)
|
||||||
{
|
{
|
||||||
assert(!name.empty());
|
assert(!name.empty());
|
||||||
PointerToAttribute h1; h1._name = name;
|
PointerToAttribute h1; h1._name = name;
|
||||||
|
@ -965,6 +981,9 @@ public:
|
||||||
return typename MeshType:: template PerVertexAttributeHandle<ATTR_TYPE>(NULL,0);
|
return typename MeshType:: template PerVertexAttributeHandle<ATTR_TYPE>(NULL,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief query the mesh for all the attributes per vertex
|
||||||
|
\returns the name of all attributes with a non-empy name.
|
||||||
|
*/
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static void GetAllPerVertexAttribute(MeshType & m, std::vector<std::string> &all){
|
static void GetAllPerVertexAttribute(MeshType & m, std::vector<std::string> &all){
|
||||||
all.clear();
|
all.clear();
|
||||||
|
@ -973,13 +992,28 @@ public:
|
||||||
if(!(*i)._name.empty())
|
if(!(*i)._name.empty())
|
||||||
{
|
{
|
||||||
typename MeshType:: template PerVertexAttributeHandle<ATTR_TYPE> hh;
|
typename MeshType:: template PerVertexAttributeHandle<ATTR_TYPE> hh;
|
||||||
hh = Allocator<MeshType>:: template GetPerVertexAttribute <ATTR_TYPE>(m,(*i)._name);
|
hh = Allocator<MeshType>:: template FindPerVertexAttribute <ATTR_TYPE>(m,(*i)._name);
|
||||||
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
||||||
all.push_back((*i)._name);
|
all.push_back((*i)._name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
void
|
||||||
|
ClearPerVertexAttribute( MeshType & m,typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE> & h){
|
||||||
|
typename std::set<PointerToAttribute > ::iterator i;
|
||||||
|
for( i = m.vert_attr.begin(); i != m.vert_attr.end(); ++i)
|
||||||
|
if( (*i)._handle == h._handle ){
|
||||||
|
for(typename MeshType::VertexIterator vi = m.vert.begin(); vi != m.vert.end(); ++vi)
|
||||||
|
h[vi] = ATTR_TYPE();
|
||||||
|
return;}
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*! \brief If the per-vertex attribute exists, delete it.
|
||||||
|
*/
|
||||||
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
DeletePerVertexAttribute( MeshType & m,typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE> & h){
|
DeletePerVertexAttribute( MeshType & m,typename MeshType::template PerVertexAttributeHandle<ATTR_TYPE> & h){
|
||||||
|
@ -988,9 +1022,8 @@ public:
|
||||||
if( (*i)._handle == h._handle ){
|
if( (*i)._handle == h._handle ){
|
||||||
delete ((SimpleTempData<VertContainer,ATTR_TYPE>*)(*i)._handle);
|
delete ((SimpleTempData<VertContainer,ATTR_TYPE>*)(*i)._handle);
|
||||||
m.vert_attr.erase(i);
|
m.vert_attr.erase(i);
|
||||||
return;}
|
return;}
|
||||||
assert(0);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Generic DeleteAttribute.
|
// Generic DeleteAttribute.
|
||||||
// It must not crash if you try to delete a non existing attribute,
|
// It must not crash if you try to delete a non existing attribute,
|
||||||
|
@ -1046,10 +1079,28 @@ public:
|
||||||
return AddPerEdgeAttribute<ATTR_TYPE>(m,std::string(""));
|
return AddPerEdgeAttribute<ATTR_TYPE>(m,std::string(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief gives a handle to a per-edge attribute with a given name and ATTR_TYPE
|
||||||
|
\returns a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it.
|
||||||
|
Otherwise return a hanlde to a newly created.
|
||||||
|
*/
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE>
|
||||||
|
GetPerEdgeAttribute( MeshType & m, std::string name = std::string("")){
|
||||||
|
typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE> h;
|
||||||
|
if(!name.empty()){
|
||||||
|
h = FindPerEdgeAttribute<ATTR_TYPE>(m,name);
|
||||||
|
if(IsValidHandle(m,h))
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
return AddPerEdgeAttribute<ATTR_TYPE>(m,name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE>
|
typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE>
|
||||||
GetPerEdgeAttribute( MeshType & m, const std::string & name){
|
FindPerEdgeAttribute( MeshType & m, const std::string & name){
|
||||||
assert(!name.empty());
|
assert(!name.empty());
|
||||||
PointerToAttribute h1; h1._name = name;
|
PointerToAttribute h1; h1._name = name;
|
||||||
typename std::set<PointerToAttribute > ::const_iterator i;
|
typename std::set<PointerToAttribute > ::const_iterator i;
|
||||||
|
@ -1067,21 +1118,27 @@ public:
|
||||||
}
|
}
|
||||||
return typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE>((*i)._handle,(*i).n_attr);
|
return typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE>((*i)._handle,(*i).n_attr);
|
||||||
}
|
}
|
||||||
// if((*i)._typename == typeid(ATTR_TYPE).name() )
|
|
||||||
// return typename MeshType:: template PerVertexAttributeHandle<ATTR_TYPE>(NULL,0);
|
|
||||||
|
|
||||||
return typename MeshType:: template PerEdgeAttributeHandle<ATTR_TYPE>(NULL,0);
|
return typename MeshType:: template PerEdgeAttributeHandle<ATTR_TYPE>(NULL,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static void GetAllPerEdgeAttribute(const MeshType & m, std::vector<std::string> &all){
|
static void GetAllPerEdgeAttribute(const MeshType & m, std::vector<std::string> &all){
|
||||||
typename std::set<PointerToAttribute > :: iterator i;
|
all.clear();
|
||||||
for(i = m.edge_attr.begin(); i != m.edge_attr.end(); ++i )
|
typename std::set<PointerToAttribute > :: const_iterator i;
|
||||||
if((*i)._typename == typeid(ATTR_TYPE).name())
|
for(i = m.edge_attr.begin(); i != m.edge_attr.end(); ++i )
|
||||||
all.push_back((*i)._name);
|
if(!(*i)._name.empty())
|
||||||
}
|
{
|
||||||
|
typename MeshType:: template PerEdgeAttributeHandle<ATTR_TYPE> hh;
|
||||||
|
hh = Allocator<MeshType>:: template FindPerEdgeAttribute <ATTR_TYPE>(m,(*i)._name);
|
||||||
|
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
||||||
|
all.push_back((*i)._name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
/*! \brief If the per-edge attribute exists, delete it.
|
||||||
|
*/
|
||||||
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
DeletePerEdgeAttribute( MeshType & m,typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE> & h){
|
DeletePerEdgeAttribute( MeshType & m,typename MeshType::template PerEdgeAttributeHandle<ATTR_TYPE> & h){
|
||||||
|
@ -1091,7 +1148,6 @@ public:
|
||||||
delete ((SimpleTempData<FaceContainer,ATTR_TYPE>*)(*i)._handle);
|
delete ((SimpleTempData<FaceContainer,ATTR_TYPE>*)(*i)._handle);
|
||||||
m.edge_attr.erase(i);
|
m.edge_attr.erase(i);
|
||||||
return;}
|
return;}
|
||||||
assert(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic DeleteAttribute.
|
// Generic DeleteAttribute.
|
||||||
|
@ -1145,11 +1201,28 @@ public:
|
||||||
AddPerFaceAttribute( MeshType & m){
|
AddPerFaceAttribute( MeshType & m){
|
||||||
return AddPerFaceAttribute<ATTR_TYPE>(m,std::string(""));
|
return AddPerFaceAttribute<ATTR_TYPE>(m,std::string(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief gives a handle to a per-edge attribute with a given name and ATTR_TYPE
|
||||||
|
\returns a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it.
|
||||||
|
Otherwise return a hanlde to a newly created.
|
||||||
|
*/
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>
|
||||||
|
GetPerFaceAttribute( MeshType & m, std::string name = std::string("")){
|
||||||
|
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE> h;
|
||||||
|
if(!name.empty()){
|
||||||
|
h = FindPerFaceAttribute<ATTR_TYPE>(m,name);
|
||||||
|
if(IsValidHandle(m,h))
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
return AddPerFaceAttribute<ATTR_TYPE>(m,name);
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>
|
typename MeshType::template PerFaceAttributeHandle<ATTR_TYPE>
|
||||||
GetPerFaceAttribute( MeshType & m, const std::string & name){
|
FindPerFaceAttribute( MeshType & m, const std::string & name){
|
||||||
assert(!name.empty());
|
assert(!name.empty());
|
||||||
PointerToAttribute h1; h1._name = name;
|
PointerToAttribute h1; h1._name = name;
|
||||||
typename std::set<PointerToAttribute > ::iterator i;
|
typename std::set<PointerToAttribute > ::iterator i;
|
||||||
|
@ -1178,12 +1251,14 @@ public:
|
||||||
if(!(*i)._name.empty())
|
if(!(*i)._name.empty())
|
||||||
{
|
{
|
||||||
typename MeshType:: template PerFaceAttributeHandle<ATTR_TYPE> hh;
|
typename MeshType:: template PerFaceAttributeHandle<ATTR_TYPE> hh;
|
||||||
hh = Allocator<MeshType>:: template GetPerFaceAttribute <ATTR_TYPE>(m,(*i)._name);
|
hh = Allocator<MeshType>:: template FindPerFaceAttribute <ATTR_TYPE>(m,(*i)._name);
|
||||||
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
if(IsValidHandle<ATTR_TYPE>(m,hh))
|
||||||
all.push_back((*i)._name);
|
all.push_back((*i)._name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief If the per-face attribute exists, delete it.
|
||||||
|
*/
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
|
@ -1194,7 +1269,7 @@ public:
|
||||||
delete ((SimpleTempData<FaceContainer,ATTR_TYPE>*)(*i)._handle);
|
delete ((SimpleTempData<FaceContainer,ATTR_TYPE>*)(*i)._handle);
|
||||||
m.face_attr.erase(i);
|
m.face_attr.erase(i);
|
||||||
return;}
|
return;}
|
||||||
assert(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic DeleteAttribute.
|
// Generic DeleteAttribute.
|
||||||
|
@ -1241,10 +1316,27 @@ public:
|
||||||
return typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>(res.first->_handle,res.first->n_attr);
|
return typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>(res.first->_handle,res.first->n_attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*! \brief gives a handle to a per-edge attribute with a given name and ATTR_TYPE
|
||||||
|
\returns a valid handle. If the name is not empty and an attribute with that name and type exists returns a handle to it.
|
||||||
|
Otherwise return a hanlde to a newly created.
|
||||||
|
*/
|
||||||
|
template <class ATTR_TYPE>
|
||||||
|
static
|
||||||
|
typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>
|
||||||
|
GetPerMeshAttribute( MeshType & m, std::string name = std::string("")){
|
||||||
|
typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE> h;
|
||||||
|
if(!name.empty()){
|
||||||
|
h = FindPerMeshAttribute<ATTR_TYPE>(m,name);
|
||||||
|
if(IsValidHandle(m,h))
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
return AddPerMeshAttribute<ATTR_TYPE>(m,name);
|
||||||
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>
|
typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE>
|
||||||
GetPerMeshAttribute( MeshType & m, const std::string & name){
|
FindPerMeshAttribute( MeshType & m, const std::string & name){
|
||||||
assert(!name.empty());
|
assert(!name.empty());
|
||||||
PointerToAttribute h1; h1._name = name;
|
PointerToAttribute h1; h1._name = name;
|
||||||
typename std::set<PointerToAttribute > ::iterator i;
|
typename std::set<PointerToAttribute > ::iterator i;
|
||||||
|
@ -1275,7 +1367,9 @@ public:
|
||||||
all.push_back((*i)._name);
|
all.push_back((*i)._name);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ATTR_TYPE>
|
/*! \brief If the per-mesh attribute exists, delete it.
|
||||||
|
*/
|
||||||
|
template <class ATTR_TYPE>
|
||||||
static
|
static
|
||||||
void
|
void
|
||||||
DeletePerMeshAttribute( MeshType & m,typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE> & h){
|
DeletePerMeshAttribute( MeshType & m,typename MeshType::template PerMeshAttributeHandle<ATTR_TYPE> & h){
|
||||||
|
@ -1285,7 +1379,6 @@ public:
|
||||||
delete (( Attribute<ATTR_TYPE> *)(*i)._handle);
|
delete (( Attribute<ATTR_TYPE> *)(*i)._handle);
|
||||||
m.mesh_attr.erase(i);
|
m.mesh_attr.erase(i);
|
||||||
return;}
|
return;}
|
||||||
assert(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* This program is distributed in the hope that it will be useful, *
|
* This program is distributed in the hope that it will be useful, *
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
|
* GNU General Public License (http://www.gnu.o/licenses/gpl.txt) *
|
||||||
* for more details. *
|
* for more details. *
|
||||||
* *
|
* *
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
|
@ -194,13 +194,13 @@ public:
|
||||||
if (!HasHandleMMatch)
|
if (!HasHandleMMatch)
|
||||||
Handle_MMatch = vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<vcg::Point3i>(mesh,std::string("MissMatch"));
|
Handle_MMatch = vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<vcg::Point3i>(mesh,std::string("MissMatch"));
|
||||||
else
|
else
|
||||||
Handle_MMatch = vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3i>(mesh,std::string("MissMatch"));
|
Handle_MMatch = vcg::tri::Allocator<MeshType>::template FindPerFaceAttribute<vcg::Point3i>(mesh,std::string("MissMatch"));
|
||||||
|
|
||||||
bool HasHandleSeams=vcg::tri::HasPerFaceAttribute(mesh,std::string("Seams"));
|
bool HasHandleSeams=vcg::tri::HasPerFaceAttribute(mesh,std::string("Seams"));
|
||||||
if (!HasHandleSeams)
|
if (!HasHandleSeams)
|
||||||
Handle_Seams=vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<vcg::Point3<bool> >(mesh,std::string("Seams"));
|
Handle_Seams=vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<vcg::Point3<bool> >(mesh,std::string("Seams"));
|
||||||
else
|
else
|
||||||
Handle_Seams=vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3<bool> >(mesh,std::string("Seams"));
|
Handle_Seams=vcg::tri::Allocator<MeshType>::template FindPerFaceAttribute<vcg::Point3<bool> >(mesh,std::string("Seams"));
|
||||||
|
|
||||||
FILE *f = fopen(PathOBJ.c_str(),"rt");
|
FILE *f = fopen(PathOBJ.c_str(),"rt");
|
||||||
if (!f)
|
if (!f)
|
||||||
|
|
|
@ -165,8 +165,6 @@ static int Open( OpenMeshType &m, std::vector<Shot<ScalarType> > & shots,
|
||||||
|
|
||||||
// load all correspondences
|
// load all correspondences
|
||||||
typename OpenMeshType::template PerVertexAttributeHandle<CorrVec> ch = vcg::tri::Allocator<OpenMeshType>::template GetPerVertexAttribute<CorrVec>(m,"correspondences");
|
typename OpenMeshType::template PerVertexAttributeHandle<CorrVec> ch = vcg::tri::Allocator<OpenMeshType>::template GetPerVertexAttribute<CorrVec>(m,"correspondences");
|
||||||
if(!vcg::tri::Allocator<OpenMeshType>::IsValidHandle(m,ch))
|
|
||||||
ch = vcg::tri::Allocator<OpenMeshType>::template AddPerVertexAttribute<CorrVec>(m,"correspondences");
|
|
||||||
|
|
||||||
typename OpenMeshType::VertexIterator vi = vcg::tri::Allocator<OpenMeshType>::AddVertices(m,num_points);
|
typename OpenMeshType::VertexIterator vi = vcg::tri::Allocator<OpenMeshType>::AddVertices(m,num_points);
|
||||||
for(uint i = 0; i < num_points;++i,++vi){
|
for(uint i = 0; i < num_points;++i,++vi){
|
||||||
|
|
|
@ -148,8 +148,6 @@ static int Open( OpenMeshType &m, std::vector<Shot<ScalarType> > & shots,
|
||||||
|
|
||||||
// load all correspondences
|
// load all correspondences
|
||||||
typename OpenMeshType::template PerVertexAttributeHandle<CorrVec> ch = vcg::tri::Allocator<OpenMeshType>::template GetPerVertexAttribute<CorrVec>(m,"correspondences");
|
typename OpenMeshType::template PerVertexAttributeHandle<CorrVec> ch = vcg::tri::Allocator<OpenMeshType>::template GetPerVertexAttribute<CorrVec>(m,"correspondences");
|
||||||
if(!vcg::tri::Allocator<OpenMeshType>::IsValidHandle(m,ch))
|
|
||||||
ch = vcg::tri::Allocator<OpenMeshType>::template AddPerVertexAttribute<CorrVec>(m,"correspondences");
|
|
||||||
|
|
||||||
typename OpenMeshType::VertexIterator vi = vcg::tri::Allocator<OpenMeshType>::AddVertices(m,num_points);
|
typename OpenMeshType::VertexIterator vi = vcg::tri::Allocator<OpenMeshType>::AddVertices(m,num_points);
|
||||||
for(uint i = 0; i < num_points;++i,++vi){
|
for(uint i = 0; i < num_points;++i,++vi){
|
||||||
|
|
|
@ -176,11 +176,9 @@ void UpdateUVBox(MeshType &mesh)
|
||||||
{
|
{
|
||||||
typedef typename MeshType::ScalarType ScalarType;
|
typedef typename MeshType::ScalarType ScalarType;
|
||||||
typename MeshType::template PerMeshAttributeHandle<vcg::Box2<ScalarType> > Handle_UVBox;
|
typename MeshType::template PerMeshAttributeHandle<vcg::Box2<ScalarType> > Handle_UVBox;
|
||||||
bool HasUVBox=vcg::tri::HasPerMeshAttribute(mesh,std::string("UVBox"));
|
|
||||||
if (!HasUVBox)
|
Handle_UVBox=vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute<vcg::Box2<ScalarType> >(mesh,std::string("UVBox"));
|
||||||
Handle_UVBox=vcg::tri::Allocator<MeshType>::template AddPerMeshAttribute<vcg::Box2<ScalarType> >(mesh,std::string("UVBox"));
|
|
||||||
else
|
|
||||||
Handle_UVBox=vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute<vcg::Box2<ScalarType> >(mesh,"UVBox");
|
|
||||||
Handle_UVBox().SetNull();
|
Handle_UVBox().SetNull();
|
||||||
for (unsigned int i=0;i<mesh.face.size();i++)
|
for (unsigned int i=0;i<mesh.face.size();i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,36 +62,11 @@ private:
|
||||||
///initialized mapping structures if are not already initialized
|
///initialized mapping structures if are not already initialized
|
||||||
void AddAttributesIfNeeded()
|
void AddAttributesIfNeeded()
|
||||||
{
|
{
|
||||||
|
Handle_MMatch = vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3i>(*mesh,std::string("MissMatch"));
|
||||||
bool HasHandleMMatch=vcg::tri::HasPerFaceAttribute(*mesh,std::string("MissMatch"));
|
Handle_Singular=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<bool>(*mesh,std::string("Singular"));
|
||||||
if (!HasHandleMMatch)
|
Handle_SingularDegree=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<int>(*mesh,std::string("SingularityDegree"));
|
||||||
Handle_MMatch = vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<vcg::Point3i>(*mesh,std::string("MissMatch"));
|
Handle_Seams=vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3<bool> >(*mesh,std::string("Seams"));
|
||||||
else
|
Handle_SeamsIndex=vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3i >(*mesh,std::string("SeamsIndex"));
|
||||||
Handle_MMatch = vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3i>(*mesh,std::string("MissMatch"));
|
|
||||||
|
|
||||||
bool HasHandleSingularity=vcg::tri::HasPerVertexAttribute(*mesh,std::string("Singular"));
|
|
||||||
if (!HasHandleSingularity)
|
|
||||||
Handle_Singular=vcg::tri::Allocator<MeshType>::template AddPerVertexAttribute<bool>(*mesh,std::string("Singular"));
|
|
||||||
else
|
|
||||||
Handle_Singular=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<bool>(*mesh,std::string("Singular"));
|
|
||||||
|
|
||||||
bool HasHandleSingularityDegree=vcg::tri::HasPerVertexAttribute(*mesh,std::string("SingularityDegree"));
|
|
||||||
if (!HasHandleSingularityDegree)
|
|
||||||
Handle_SingularDegree=vcg::tri::Allocator<MeshType>::template AddPerVertexAttribute<int>(*mesh,std::string("SingularityDegree"));
|
|
||||||
else
|
|
||||||
Handle_SingularDegree=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<int>(*mesh,std::string("SingularityDegree"));
|
|
||||||
|
|
||||||
bool HasHandleSeams=vcg::tri::HasPerFaceAttribute(*mesh,std::string("Seams"));
|
|
||||||
if (!HasHandleSeams)
|
|
||||||
Handle_Seams=vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<vcg::Point3<bool> >(*mesh,std::string("Seams"));
|
|
||||||
else
|
|
||||||
Handle_Seams=vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3<bool> >(*mesh,std::string("Seams"));
|
|
||||||
|
|
||||||
bool HasHandleSeamsIndex=vcg::tri::HasPerFaceAttribute(*mesh,std::string("SeamsIndex"));
|
|
||||||
if (!HasHandleSeamsIndex)
|
|
||||||
Handle_SeamsIndex=vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<vcg::Point3i >(*mesh,std::string("SeamsIndex"));
|
|
||||||
else
|
|
||||||
Handle_SeamsIndex=vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3i >(*mesh,std::string("SeamsIndex"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ public:
|
||||||
if(!hasStiffness)
|
if(!hasStiffness)
|
||||||
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
||||||
else
|
else
|
||||||
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template FindPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
||||||
|
|
||||||
bool hasSingular = vcg::tri::HasPerVertexAttribute(mesh,std::string("Singular"));
|
bool hasSingular = vcg::tri::HasPerVertexAttribute(mesh,std::string("Singular"));
|
||||||
assert(hasSingular);
|
assert(hasSingular);
|
||||||
|
@ -114,7 +114,7 @@ public:
|
||||||
if(!hasStiffness)
|
if(!hasStiffness)
|
||||||
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
||||||
else
|
else
|
||||||
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template FindPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
||||||
|
|
||||||
bool flipped = NumFlips(mesh)>0;
|
bool flipped = NumFlips(mesh)>0;
|
||||||
//if (h == 0.0)
|
//if (h == 0.0)
|
||||||
|
@ -155,7 +155,7 @@ public:
|
||||||
if(!hasStiffness)
|
if(!hasStiffness)
|
||||||
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
||||||
else
|
else
|
||||||
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
Handle_Stiffness=vcg::tri::Allocator<MeshType>::template FindPerFaceAttribute<float>(mesh,std::string("Stiffness"));
|
||||||
|
|
||||||
for(unsigned int i=0;i<mesh.face.size();i++)
|
for(unsigned int i=0;i<mesh.face.size();i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -277,11 +277,7 @@ private:
|
||||||
|
|
||||||
///other per mesh attributes
|
///other per mesh attributes
|
||||||
///see if already exists otherwise it creates it
|
///see if already exists otherwise it creates it
|
||||||
bool HasSystemInfo=vcg::tri::HasPerMeshAttribute(*mesh,std::string("SystemInfo"));
|
Handle_SystemInfo=vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute<MeshSystemInfo>(*mesh,std::string("SystemInfo"));
|
||||||
if (!HasSystemInfo)
|
|
||||||
Handle_SystemInfo=vcg::tri::Allocator<MeshType>::template AddPerMeshAttribute<MeshSystemInfo>(*mesh,std::string("SystemInfo"));
|
|
||||||
else
|
|
||||||
Handle_SystemInfo=vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute<MeshSystemInfo>(*mesh,"SystemInfo");
|
|
||||||
|
|
||||||
Handle_SystemInfo().num_scalar_variables=0;
|
Handle_SystemInfo().num_scalar_variables=0;
|
||||||
Handle_SystemInfo().num_vert_variables=0;
|
Handle_SystemInfo().num_vert_variables=0;
|
||||||
|
@ -289,40 +285,27 @@ private:
|
||||||
|
|
||||||
duplicated.clear();
|
duplicated.clear();
|
||||||
|
|
||||||
bool HasSystemIndex=vcg::tri::HasPerFaceAttribute(*mesh,std::string("SystemIndex"));
|
HandleS_Index = vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3i>(*mesh,std::string("SystemIndex"));
|
||||||
if (!HasSystemIndex)
|
|
||||||
HandleS_Index = vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<vcg::Point3i>(*mesh,std::string("SystemIndex"));
|
|
||||||
else
|
|
||||||
HandleS_Index = vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3i>(*mesh,std::string("SystemIndex"));
|
|
||||||
|
|
||||||
bool HasHandleInteger=vcg::tri::HasPerFaceAttribute(*mesh,std::string("Integer"));
|
Handle_Integer= vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3i>(*mesh,std::string("Integer"));
|
||||||
if (!HasHandleInteger)
|
HandleV_Integer=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<std::vector<int> >(*mesh,std::string("VertInteger"));
|
||||||
Handle_Integer= vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<vcg::Point3i>(*mesh,std::string("Integer"));
|
|
||||||
else
|
|
||||||
Handle_Integer= vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3i>(*mesh,std::string("Integer"));
|
|
||||||
|
|
||||||
bool HasHandleVertexInteger=vcg::tri::HasPerVertexAttribute(*mesh,std::string("VertInteger"));
|
|
||||||
if (!HasHandleVertexInteger)
|
|
||||||
HandleV_Integer=vcg::tri::Allocator<MeshType>::template AddPerVertexAttribute<std::vector<int> >(*mesh,std::string("VertInteger"));
|
|
||||||
else
|
|
||||||
HandleV_Integer=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<std::vector<int> >(*mesh,std::string("VertInteger"));
|
|
||||||
|
|
||||||
|
|
||||||
bool HasHandleMMatch=vcg::tri::HasPerFaceAttribute(*mesh,std::string("MissMatch"));
|
bool HasHandleMMatch=vcg::tri::HasPerFaceAttribute(*mesh,std::string("MissMatch"));
|
||||||
assert(HasHandleMMatch);
|
assert(HasHandleMMatch);
|
||||||
Handle_MMatch = vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3i>(*mesh,std::string("MissMatch"));
|
Handle_MMatch = vcg::tri::Allocator<MeshType>::template FindPerFaceAttribute<vcg::Point3i>(*mesh,std::string("MissMatch"));
|
||||||
|
|
||||||
bool HasHandleSingularity=vcg::tri::HasPerVertexAttribute(*mesh,std::string("Singular"));
|
bool HasHandleSingularity=vcg::tri::HasPerVertexAttribute(*mesh,std::string("Singular"));
|
||||||
assert(HasHandleSingularity);
|
assert(HasHandleSingularity);
|
||||||
Handle_Singular=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<bool>(*mesh,std::string("Singular"));
|
Handle_Singular=vcg::tri::Allocator<MeshType>::template FindPerVertexAttribute<bool>(*mesh,std::string("Singular"));
|
||||||
|
|
||||||
bool HasHandleSingularityDegree=vcg::tri::HasPerVertexAttribute(*mesh,std::string("SingularityDegree"));
|
bool HasHandleSingularityDegree=vcg::tri::HasPerVertexAttribute(*mesh,std::string("SingularityDegree"));
|
||||||
assert(HasHandleSingularityDegree);
|
assert(HasHandleSingularityDegree);
|
||||||
Handle_SingularDegree=vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<int>(*mesh,std::string("SingularityDegree"));
|
Handle_SingularDegree=vcg::tri::Allocator<MeshType>::template FindPerVertexAttribute<int>(*mesh,std::string("SingularityDegree"));
|
||||||
|
|
||||||
bool HasHandleSeams=vcg::tri::HasPerFaceAttribute(*mesh,std::string("Seams"));
|
bool HasHandleSeams=vcg::tri::HasPerFaceAttribute(*mesh,std::string("Seams"));
|
||||||
assert(HasHandleSeams);
|
assert(HasHandleSeams);
|
||||||
Handle_Seams=vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<vcg::Point3<bool> >(*mesh,std::string("Seams"));
|
Handle_Seams=vcg::tri::Allocator<MeshType>::template FindPerFaceAttribute<vcg::Point3<bool> >(*mesh,std::string("Seams"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue