mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-18 10:34:41 +00:00
Update use og vcg::tri::Allocate< >::Get*Attribute
to revision 4811 of vcglib (below): ----------------------------------------------------------------------- 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
546f188d17
commit
c4600248ee
@ -305,40 +305,32 @@ void ExtraMeshDecoratePlugin::decorateMesh(QAction *a, MeshModel &m, RichParamet
|
||||
{
|
||||
CMeshO::PerMeshAttributeHandle<CHist > qH;
|
||||
qH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<CHist>(m.cm,"QualityHist");
|
||||
|
||||
if(vcg::tri::Allocator<CMeshO>::IsValidHandle (m.cm, qH)) {
|
||||
CHist &ch=qH();
|
||||
this->DrawColorHistogram(ch,gla, painter,rm,qf);
|
||||
}
|
||||
CHist &ch=qH();
|
||||
this->DrawColorHistogram(ch,gla, painter,rm,qf);
|
||||
} break;
|
||||
case DP_SHOW_NON_MANIF_VERT :
|
||||
{
|
||||
// Note the standard way for adding extra per-mesh data using the per-mesh attributes.
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > vvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<vector<PointPC> >(m.cm,"NonManifVertVertVector");
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > tvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<vector<PointPC> >(m.cm,"NonManifVertTriVector");
|
||||
if(vcg::tri::Allocator<CMeshO>::IsValidHandle (m.cm, vvH))
|
||||
{
|
||||
DrawDotVector(vvH());
|
||||
DrawTriVector(tvH());
|
||||
DrawDotVector(vvH());
|
||||
DrawTriVector(tvH());
|
||||
|
||||
this->RealTimeLog("Non Manifold Vertices",m.shortName(),
|
||||
this->RealTimeLog("Non Manifold Vertices",m.shortName(),
|
||||
"<b>%i</b> non manifold vertices<br> "
|
||||
"<b>%i</b> faces over non manifold vertices",vvH().size(),tvH().size()/3);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
break;
|
||||
case DP_SHOW_NON_MANIF_EDGE :
|
||||
{
|
||||
// Note the standard way for adding extra per-mesh data using the per-mesh attributes.
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > bvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<vector<PointPC> >(m.cm,"NonManifEdgeVector");
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > fvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<vector<PointPC> >(m.cm,"NonManifFaceVector");
|
||||
if(vcg::tri::Allocator<CMeshO>::IsValidHandle (m.cm, bvH))
|
||||
{
|
||||
DrawLineVector(bvH());
|
||||
DrawTriVector(fvH());
|
||||
this->RealTimeLog("Non Manifold Edges",m.shortName(),
|
||||
" <b>%i</b> non manifold edges<br>"
|
||||
" <b>%i</b> faces over non manifold edges",bvH().size()/2,fvH().size()/3);
|
||||
}
|
||||
DrawLineVector(bvH());
|
||||
DrawTriVector(fvH());
|
||||
this->RealTimeLog("Non Manifold Edges",m.shortName(),
|
||||
" <b>%i</b> non manifold edges<br>"
|
||||
" <b>%i</b> faces over non manifold edges",bvH().size()/2,fvH().size()/3);
|
||||
} break;
|
||||
case DP_SHOW_BOUNDARY :
|
||||
{
|
||||
@ -346,19 +338,14 @@ void ExtraMeshDecoratePlugin::decorateMesh(QAction *a, MeshModel &m, RichParamet
|
||||
// Note the standard way for adding extra per-mesh data using the per-mesh attributes.
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > bvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<vector<PointPC> >(m.cm,"BoundaryVertVector");
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > bfH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<vector<PointPC> >(m.cm,"BoundaryFaceVector");
|
||||
if(vcg::tri::Allocator<CMeshO>::IsValidHandle (m.cm, bvH))
|
||||
{
|
||||
DrawLineVector(bvH());
|
||||
if(showBorderFlag) DrawTriVector(bfH());
|
||||
this->RealTimeLog("Boundary",m.shortName(),"<b>%i</b> boundary edges",bvH().size()/2);
|
||||
}
|
||||
} break;
|
||||
case DP_SHOW_BOUNDARY_TEX :
|
||||
{
|
||||
// Note the standard way for adding extra per-mesh data using the per-mesh attributes.
|
||||
CMeshO::PerMeshAttributeHandle< vector<Point3f> > btvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<vector<Point3f> >(m.cm,"BoundaryTexVector");
|
||||
if(vcg::tri::Allocator<CMeshO>::IsValidHandle (m.cm, btvH))
|
||||
{
|
||||
vector<Point3f> *BTVp = &btvH();
|
||||
if (BTVp->size() != 0)
|
||||
{
|
||||
@ -378,7 +365,6 @@ void ExtraMeshDecoratePlugin::decorateMesh(QAction *a, MeshModel &m, RichParamet
|
||||
glDisableClientState (GL_VERTEX_ARRAY);
|
||||
glPopAttrib();
|
||||
}
|
||||
}
|
||||
} break;
|
||||
} // end switch;
|
||||
glPopMatrix();
|
||||
@ -818,8 +804,6 @@ bool ExtraMeshDecoratePlugin::startDecorate(QAction * action, MeshModel &m, Rich
|
||||
case DP_SHOW_NON_FAUX_EDGE :
|
||||
{
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > bvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute< vector<PointPC> >(m.cm,"ExtraordinaryVertexVector");
|
||||
if(!vcg::tri::Allocator<CMeshO>::IsValidHandle(m.cm,bvH))
|
||||
bvH=vcg::tri::Allocator<CMeshO>::AddPerMeshAttribute< vector<PointPC> >(m.cm,std::string("ExtraordinaryVertexVector"));
|
||||
vector<PointPC> *BVp = &bvH();
|
||||
BVp->clear();
|
||||
|
||||
@ -885,10 +869,6 @@ bool ExtraMeshDecoratePlugin::startDecorate(QAction * action, MeshModel &m, Rich
|
||||
{
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > bvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute< vector<PointPC> >(m.cm,"BoundaryVertVector");
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > bfH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute< vector<PointPC> >(m.cm,"BoundaryFaceVector");
|
||||
if(!vcg::tri::Allocator<CMeshO>::IsValidHandle(m.cm,bvH)){
|
||||
bvH=vcg::tri::Allocator<CMeshO>::AddPerMeshAttribute< vector<PointPC> >(m.cm,std::string("BoundaryVertVector"));
|
||||
bfH=vcg::tri::Allocator<CMeshO>::AddPerMeshAttribute< vector<PointPC> >(m.cm,std::string("BoundaryFaceVector"));
|
||||
}
|
||||
vector<PointPC> *BVp = &bvH();
|
||||
vector<PointPC> *BFp = &bfH();
|
||||
BVp->clear();
|
||||
@ -919,8 +899,6 @@ bool ExtraMeshDecoratePlugin::startDecorate(QAction * action, MeshModel &m, Rich
|
||||
{
|
||||
m.updateDataMask(MeshModel::MM_FACEFACETOPO);
|
||||
CMeshO::PerMeshAttributeHandle< vector<Point3f> > btvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute< vector<Point3f> >(m.cm,"BoundaryTexVector");
|
||||
if(!vcg::tri::Allocator<CMeshO>::IsValidHandle(m.cm,btvH))
|
||||
btvH=vcg::tri::Allocator<CMeshO>::AddPerMeshAttribute< vector<Point3f> >(m.cm,std::string("BoundaryTexVector"));
|
||||
vector<Point3f> *BTVp = &btvH();
|
||||
BTVp->clear();
|
||||
vector<std::pair<CMeshO::FacePointer,int> > SaveTopoVec;
|
||||
@ -955,11 +933,6 @@ bool ExtraMeshDecoratePlugin::startDecorate(QAction * action, MeshModel &m, Rich
|
||||
{
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > bvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute< vector<PointPC> >(m.cm,"NonManifVertVertVector");
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > fvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute< vector<PointPC> >(m.cm,"NonManifVertTriVector");
|
||||
if(!vcg::tri::Allocator<CMeshO>::IsValidHandle(m.cm,bvH))
|
||||
{
|
||||
bvH=vcg::tri::Allocator<CMeshO>::AddPerMeshAttribute< vector<PointPC> >(m.cm,std::string("NonManifVertVertVector"));
|
||||
fvH=vcg::tri::Allocator<CMeshO>::AddPerMeshAttribute< vector<PointPC> >(m.cm,std::string("NonManifVertTriVector"));
|
||||
}
|
||||
vector<PointPC> *BVp = &bvH();
|
||||
vector<PointPC> *FVp = &fvH();
|
||||
BVp->clear();
|
||||
@ -998,11 +971,6 @@ bool ExtraMeshDecoratePlugin::startDecorate(QAction * action, MeshModel &m, Rich
|
||||
{
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > bvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute< vector<PointPC> >(m.cm,"NonManifEdgeVector");
|
||||
CMeshO::PerMeshAttributeHandle< vector<PointPC> > fvH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute< vector<PointPC> >(m.cm,"NonManifFaceVector");
|
||||
if(!vcg::tri::Allocator<CMeshO>::IsValidHandle(m.cm,bvH))
|
||||
{
|
||||
bvH=vcg::tri::Allocator<CMeshO>::AddPerMeshAttribute< vector<PointPC> >(m.cm,std::string("NonManifEdgeVector"));
|
||||
fvH=vcg::tri::Allocator<CMeshO>::AddPerMeshAttribute< vector<PointPC> >(m.cm,std::string("NonManifFaceVector"));
|
||||
}
|
||||
vector<PointPC> *BVp = &bvH();
|
||||
vector<PointPC> *FVp = &fvH();
|
||||
BVp->clear();
|
||||
@ -1046,8 +1014,6 @@ bool ExtraMeshDecoratePlugin::startDecorate(QAction * action, MeshModel &m, Rich
|
||||
if( perVertFlag && !(tri::HasPerVertexQuality(m.cm) && tri::HasPerVertexColor(m.cm)) ) return false;
|
||||
if(!perVertFlag && !(tri::HasPerFaceQuality(m.cm) && tri::HasPerFaceColor(m.cm)) ) return false;
|
||||
CMeshO::PerMeshAttributeHandle<CHist > qH = vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<CHist>(m.cm,"QualityHist");
|
||||
if(!vcg::tri::Allocator<CMeshO>::IsValidHandle(m.cm,qH))
|
||||
qH=vcg::tri::Allocator<CMeshO>::AddPerMeshAttribute<CHist> (m.cm,std::string("QualityHist"));
|
||||
|
||||
CHist *H = &qH();
|
||||
std::pair<float,float> minmax;
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
#include <vcg/complex/algorithms/clean.h>
|
||||
#include <vcg/complex/algorithms/update/position.h>
|
||||
#include <vcg/complex/algorithms/update/edges.h>
|
||||
//#include <vcg/complex/algorithms/update/edges.h>
|
||||
#include <vcg/complex/algorithms/update/flag.h>
|
||||
#include <vcg/complex/algorithms/update/normal.h>
|
||||
#include <vcg/complex/algorithms/update/bounding.h>
|
||||
@ -55,7 +55,7 @@ bool AlignPair::A2Mesh::InitVert(const Matrix44d &Tr,bool hasborderflag)
|
||||
{
|
||||
Matrix44d Idn; Idn.SetIdentity();
|
||||
if(Tr!=Idn) tri::UpdatePosition<A2Mesh>::Matrix(*this,Tr);
|
||||
tri::UpdateNormal<A2Mesh>::NormalizeVertex(*this);
|
||||
tri::UpdateNormal<A2Mesh>::NormalizePerVertex(*this);
|
||||
tri::UpdateBounding<A2Mesh>::Box(*this);
|
||||
return true;
|
||||
}
|
||||
@ -76,8 +76,6 @@ bool AlignPair::A2Mesh::Init(const Matrix44d &Tr,bool hasborderflag)
|
||||
//int t5=clock();
|
||||
tri::UpdateBounding<A2Mesh>::Box(*this);
|
||||
//int t6=clock();
|
||||
tri::UpdateEdges<A2Mesh>::Set(*this);
|
||||
//int t7=clock();
|
||||
|
||||
/* printf("LoadPly %6i\n",t1-t0);
|
||||
printf("RemoveUnrefVert %6i\n",t2-t1);
|
||||
|
||||
@ -280,7 +280,7 @@ void ConvertMesh(const MESH &M1, A2Mesh &M2)
|
||||
M2.face.resize(M1.fn);
|
||||
for(vi=M1.vert.begin(),v2i=M2.vert.begin();vi!=M1.vert.end();++vi)
|
||||
if(!(*vi).IsD()){
|
||||
(*v2i).Flags()=(*vi).Flags();
|
||||
(*v2i).Flags()=(*vi).cFlags();
|
||||
(*v2i).P().Import((*vi).P());
|
||||
(*v2i).N().Import((*vi).cN());
|
||||
(*v2i).N().Normalize();
|
||||
@ -293,7 +293,7 @@ void ConvertMesh(const MESH &M1, A2Mesh &M2)
|
||||
typename A2Mesh::FaceIterator f2i;
|
||||
|
||||
for(fi=M1.face.begin(),f2i=M2.face.begin();fi!=M1.face.end();++fi)if(!(*fi).IsD()){
|
||||
(*f2i).Flags()=(*fi).Flags();
|
||||
(*f2i).Flags()=(*fi).cFlags();
|
||||
(*f2i).V(0)=&M2.vert[ (vmap[(*fi).V(0)-&M1.vert[0] ]) ];
|
||||
(*f2i).V(1)=&M2.vert[ (vmap[(*fi).V(1)-&M1.vert[0] ]) ];
|
||||
(*f2i).V(2)=&M2.vert[ (vmap[(*fi).V(2)-&M1.vert[0] ]) ];
|
||||
@ -318,7 +318,7 @@ void ConvertVertex(const std::vector<VERTEX> &vert1, std::vector<A2Vertex> &vert
|
||||
vert2.clear();
|
||||
typename std::vector<VERTEX>::const_iterator vi;
|
||||
A2Vertex tv;
|
||||
tv.UberFlags()=0;
|
||||
tv.Flags()=0;
|
||||
Box3<typename VERTEX::ScalarType> bb;
|
||||
if(Clip){
|
||||
bb.Import(*Clip);
|
||||
|
||||
@ -541,7 +541,7 @@ void PickPointsDialog::setCurrentMeshModel(MeshModel *newMeshModel, GLArea *gla)
|
||||
if(vcg::tri::HasPerMeshAttribute(newMeshModel->cm, PickedPoints::Key))
|
||||
{
|
||||
CMeshO::PerMeshAttributeHandle<PickedPoints*> ppHandle =
|
||||
vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<PickedPoints*>(newMeshModel->cm, PickedPoints::Key);
|
||||
vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<PickedPoints*>(newMeshModel->cm, PickedPoints::Key);
|
||||
|
||||
PickedPoints *pickedPoints = ppHandle();
|
||||
|
||||
@ -786,11 +786,7 @@ void PickPointsDialog::savePointsToMetaData()
|
||||
{
|
||||
//save the points to the metadata
|
||||
if(NULL != meshModel){
|
||||
CMeshO::PerMeshAttributeHandle<PickedPoints*> ppHandle =
|
||||
(vcg::tri::HasPerMeshAttribute(meshModel->cm, PickedPoints::Key) ?
|
||||
vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<PickedPoints*> (meshModel->cm, PickedPoints::Key) :
|
||||
vcg::tri::Allocator<CMeshO>::AddPerMeshAttribute<PickedPoints*> (meshModel->cm, PickedPoints::Key) );
|
||||
|
||||
CMeshO::PerMeshAttributeHandle<PickedPoints*> ppHandle =vcg::tri::Allocator<CMeshO>::GetPerMeshAttribute<PickedPoints*> (meshModel->cm, PickedPoints::Key);
|
||||
ppHandle() = getPickedPoints();
|
||||
|
||||
//qDebug() << "saved points";
|
||||
|
||||
@ -115,11 +115,7 @@ static void Dijkstra(_MyMeshType& m, VertexType& v, int numOfNeighbours, float m
|
||||
|
||||
notReachableVect.clear();
|
||||
|
||||
typename _MyMeshType::template PerVertexAttributeHandle<float> distFromCenter;
|
||||
if (!hasDistParam) {
|
||||
distFromCenter = tri::Allocator<_MyMeshType>::template AddPerVertexAttribute<float>(m, std::string("DistParam"));
|
||||
}
|
||||
else distFromCenter = tri::Allocator<_MyMeshType>::template GetPerVertexAttribute<float>(m, std::string("DistParam"));
|
||||
typename _MyMeshType::template PerVertexAttributeHandle<float> distFromCenter = vcg::tri::Allocator<_MyMeshType>::template GetPerVertexAttribute<float>(m, std::string("DistParam"));
|
||||
|
||||
if (!hasKNNGraph) {
|
||||
KNNGraph<_MyMeshType>::MakeKNNTree(m, numOfNeighbours);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#define KNNGRAPH_H
|
||||
|
||||
#include <QTime>
|
||||
#include <Vector>
|
||||
#include <vector>
|
||||
#include <vcg/complex/complex.h>
|
||||
#include <vcg/space/index/kdtree/kdtree.h>
|
||||
|
||||
|
||||
@ -202,14 +202,11 @@ bool GeometryAgingPlugin::applyFilter(QAction *filter, MeshDocument &md, RichPar
|
||||
|
||||
// if requested, add erosion attribute to vertexes and initialize it
|
||||
if(storeDispl) {
|
||||
CMeshO::PerVertexAttributeHandle<Point3f> vah =
|
||||
(tri::HasPerVertexAttribute(m.cm, "Erosion") ?
|
||||
tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f>(m.cm, "Erosion") :
|
||||
tri::Allocator<CMeshO>::AddPerVertexAttribute<Point3f>(m.cm, std::string("Erosion")));
|
||||
CMeshO::PerVertexAttributeHandle<Point3f> vah = tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f>(m.cm, "Erosion");
|
||||
for(CMeshO::VertexIterator vi=m.cm.vert.begin(); vi!=m.cm.vert.end(); vi++)
|
||||
vah[vi] = Point3f(0.0, 0.0, 0.0);
|
||||
}
|
||||
CMeshO::PerVertexAttributeHandle<Point3f> vah = vcg::tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f>(m.cm, "Erosion");
|
||||
CMeshO::PerVertexAttributeHandle<Point3f> vah = vcg::tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f>(m.cm, "Erosion");
|
||||
|
||||
// vertexes along selection border will not be displaced
|
||||
if(selected) tri::UpdateSelection<CMeshO>::VertexFromFaceStrict(m.cm);
|
||||
@ -368,7 +365,7 @@ void GeometryAgingPlugin::smoothPeaks(CMeshO &m, bool selected, bool updateErosi
|
||||
GridStaticPtr<CFaceO, CMeshO::ScalarType> gM;
|
||||
gM.Set(m.face.begin(), m.face.end());
|
||||
CMeshO::PerVertexAttributeHandle<Point3f> vah =
|
||||
vcg::tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f>(m, "Erosion");
|
||||
vcg::tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f>(m, "Erosion");
|
||||
|
||||
for(CMeshO::FaceIterator fi=m.face.begin(); fi!=m.face.end(); fi++) {
|
||||
if((*fi).IsD()) continue;
|
||||
@ -402,7 +399,7 @@ void GeometryAgingPlugin::computeMeanCurvature(CMeshO &m)
|
||||
if(delvert) Log( "Pre-Curvature Cleaning: Removed %d unreferenced vertices", delvert);
|
||||
tri::Allocator<CMeshO>::CompactVertexVector(m);
|
||||
tri::UpdateCurvature<CMeshO>::MeanAndGaussian(m);
|
||||
tri::UpdateQuality<CMeshO>::VertexFromMeanCurvature(m);
|
||||
tri::UpdateQuality<CMeshO>::VertexFromMeanCurvatureHG(m);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -194,14 +194,12 @@ bool AmbientOcclusionPlugin::processGL(MeshModel &m, vector<Point3f> &posVect)
|
||||
vcg::tri::Allocator<CMeshO>::CompactFaceVector(m.cm);
|
||||
vcg::tri::UpdateNormal<CMeshO>::PerVertexNormalizedPerFaceNormalized(m.cm);
|
||||
|
||||
CMeshO::PerVertexAttributeHandle<Point3f> BN = tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f>(m.cm, "BentNormal");
|
||||
if(!tri::Allocator<CMeshO>::IsValidHandle<Point3f>(m.cm,BN))
|
||||
{
|
||||
BN = tri::Allocator<CMeshO>::AddPerVertexAttribute<Point3f> (m.cm,"BentNormal");
|
||||
std::vector<std::string> AllVertexAttribName;
|
||||
tri::Allocator<CMeshO>::GetAllPerVertexAttribute< Point3f >(m.cm,AllVertexAttribName);
|
||||
qDebug("Now mesh has %i attrib",AllVertexAttribName.size());
|
||||
}
|
||||
CMeshO::PerVertexAttributeHandle<Point3f> BN = tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f>(m.cm, "BentNormal");
|
||||
|
||||
std::vector<std::string> AllVertexAttribName;
|
||||
tri::Allocator<CMeshO>::GetAllPerVertexAttribute< Point3f >(m.cm,AllVertexAttribName);
|
||||
qDebug("Now mesh has %i attrib",AllVertexAttribName.size());
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_LEQUAL);
|
||||
|
||||
|
||||
@ -590,7 +590,7 @@ template<class MESH_TYPE, class FEATURE_TYPE> class FeatureAlignment
|
||||
else return PVAttributeHandle(NULL,0);
|
||||
}
|
||||
//now we can get a handle to the attribute and return it
|
||||
return tri::Allocator<MeshType>::template GetPerVertexAttribute<FeatureType> (m,std::string(FeatureType::getName()));
|
||||
return tri::Allocator<MeshType>::template FindPerVertexAttribute<FeatureType> (m,std::string(FeatureType::getName()));
|
||||
}
|
||||
|
||||
/** \brief Extracts \c numRequested features from mesh \c m using the specified \c samplingStrategy.
|
||||
@ -825,7 +825,7 @@ template<class MESH_TYPE, class FEATURE_TYPE> class FeatureAlignment
|
||||
pph = tri::Allocator<MeshType>::template AddPerMeshAttribute<PickedPoints*>(m,PickedPoints::Key);
|
||||
pph() = new PickedPoints();
|
||||
}
|
||||
else pph = tri::Allocator<MeshType>::template GetPerMeshAttribute<PickedPoints*>(m, PickedPoints::Key);
|
||||
else pph = tri::Allocator<MeshType>::template FindPerMeshAttribute<PickedPoints*>(m, PickedPoints::Key);
|
||||
|
||||
for(unsigned int i=0; i<vecF.size(); i++){
|
||||
//build up a point name made of an id and feature value...
|
||||
@ -849,7 +849,7 @@ template<class MESH_TYPE, class FEATURE_TYPE> class FeatureAlignment
|
||||
PMAttributeHandle pph;
|
||||
//we get a handle to the attribute if it exists
|
||||
if(!tri::HasPerMeshAttribute(m, PickedPoints::Key)) return;
|
||||
pph = tri::Allocator<MeshType>::template GetPerMeshAttribute<PickedPoints*>(m, PickedPoints::Key);
|
||||
pph = tri::Allocator<MeshType>::template FindPerMeshAttribute<PickedPoints*>(m, PickedPoints::Key);
|
||||
|
||||
//delete previous picked points
|
||||
(pph()->getPickedPointVector())->clear();
|
||||
@ -869,7 +869,7 @@ template<class MESH_TYPE, class FEATURE_TYPE> class FeatureAlignment
|
||||
pph = tri::Allocator<MeshType>::template AddPerMeshAttribute<PickedPoints*>(m,PickedPoints::Key);
|
||||
pph() = new PickedPoints();
|
||||
}
|
||||
else pph = tri::Allocator<MeshType>::template GetPerMeshAttribute<PickedPoints*>(m, PickedPoints::Key);
|
||||
else pph = tri::Allocator<MeshType>::template FindPerMeshAttribute<PickedPoints*>(m, PickedPoints::Key);
|
||||
|
||||
(pph()->getPickedPointVector())->clear(); //clear old contents
|
||||
|
||||
|
||||
@ -756,7 +756,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, RichPa
|
||||
CMeshO::PerVertexAttributeHandle<float> h;
|
||||
if(tri::HasPerVertexAttribute(m.cm,name))
|
||||
{
|
||||
h = tri::Allocator<CMeshO>::GetPerVertexAttribute<float>(m.cm, name);
|
||||
h = tri::Allocator<CMeshO>::FindPerVertexAttribute<float>(m.cm, name);
|
||||
if(!tri::Allocator<CMeshO>::IsValidHandle<float>(m.cm,h))
|
||||
{
|
||||
errorMessage = "attribute already exists with a different type";
|
||||
@ -814,7 +814,7 @@ bool FilterFunctionPlugin::applyFilter(QAction *filter, MeshDocument &md, RichPa
|
||||
CMeshO::PerFaceAttributeHandle<float> h;
|
||||
if(tri::HasPerFaceAttribute(m.cm,name))
|
||||
{
|
||||
h = tri::Allocator<CMeshO>::GetPerFaceAttribute<float>(m.cm, name);
|
||||
h = tri::Allocator<CMeshO>::FindPerFaceAttribute<float>(m.cm, name);
|
||||
if(!tri::Allocator<CMeshO>::IsValidHandle<float>(m.cm,h))
|
||||
{
|
||||
errorMessage = "attribute already exists with a different type";
|
||||
@ -1170,40 +1170,36 @@ void FilterFunctionPlugin::setPerVertexVariables(Parser &p, CMeshO &m)
|
||||
for(int i = 0; i < (int) AllVertexAttribName.size(); i++)
|
||||
{
|
||||
CMeshO::PerVertexAttributeHandle<float> hh = tri::Allocator<CMeshO>::GetPerVertexAttribute<float>(m, AllVertexAttribName[i]);
|
||||
if(tri::Allocator<CMeshO>::IsValidHandle<float>(m,hh))
|
||||
{
|
||||
v_handlers.push_back(hh);
|
||||
v_attrNames.push_back(AllVertexAttribName[i]);
|
||||
v_attrValue.push_back(0);
|
||||
p.DefineVar(v_attrNames.back(), &v_attrValue.back());
|
||||
qDebug("Adding custom per vertex float variable %s",v_attrNames.back().c_str());
|
||||
}
|
||||
v_handlers.push_back(hh);
|
||||
v_attrNames.push_back(AllVertexAttribName[i]);
|
||||
v_attrValue.push_back(0);
|
||||
p.DefineVar(v_attrNames.back(), &v_attrValue.back());
|
||||
qDebug("Adding custom per vertex float variable %s",v_attrNames.back().c_str());
|
||||
}
|
||||
AllVertexAttribName.clear();
|
||||
tri::Allocator<CMeshO>::GetAllPerVertexAttribute< Point3f >(m,AllVertexAttribName);
|
||||
for(int i = 0; i < (int) AllVertexAttribName.size(); i++)
|
||||
{
|
||||
CMeshO::PerVertexAttributeHandle<Point3f> hh3 = tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f>(m, AllVertexAttribName[i]);
|
||||
if(tri::Allocator<CMeshO>::IsValidHandle<Point3f>(m,hh3))
|
||||
{
|
||||
v3_handlers.push_back(hh3);
|
||||
|
||||
v3_attrValue.push_back(0);
|
||||
v3_attrNames.push_back(AllVertexAttribName[i]+"_x");
|
||||
p.DefineVar(v3_attrNames.back(), &v3_attrValue.back());
|
||||
v3_handlers.push_back(hh3);
|
||||
|
||||
v3_attrValue.push_back(0);
|
||||
v3_attrNames.push_back(AllVertexAttribName[i]+"_y");
|
||||
p.DefineVar(v3_attrNames.back(), &v3_attrValue.back());
|
||||
v3_attrValue.push_back(0);
|
||||
v3_attrNames.push_back(AllVertexAttribName[i]+"_x");
|
||||
p.DefineVar(v3_attrNames.back(), &v3_attrValue.back());
|
||||
|
||||
v3_attrValue.push_back(0);
|
||||
v3_attrNames.push_back(AllVertexAttribName[i]+"_z");
|
||||
p.DefineVar(v3_attrNames.back(), &v3_attrValue.back());
|
||||
qDebug("Adding custom per vertex Point3f variable %s",v3_attrNames.back().c_str());
|
||||
}
|
||||
}
|
||||
v3_attrValue.push_back(0);
|
||||
v3_attrNames.push_back(AllVertexAttribName[i]+"_y");
|
||||
p.DefineVar(v3_attrNames.back(), &v3_attrValue.back());
|
||||
|
||||
v3_attrValue.push_back(0);
|
||||
v3_attrNames.push_back(AllVertexAttribName[i]+"_z");
|
||||
p.DefineVar(v3_attrNames.back(), &v3_attrValue.back());
|
||||
qDebug("Adding custom per vertex Point3f variable %s",v3_attrNames.back().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Function explicitely define parser variables to perform Per-Face filter action
|
||||
void FilterFunctionPlugin::setPerFaceVariables(Parser &p, CMeshO &m)
|
||||
{
|
||||
@ -1281,13 +1277,10 @@ void FilterFunctionPlugin::setPerFaceVariables(Parser &p, CMeshO &m)
|
||||
for(int i = 0; i < (int) AllFaceAttribName.size(); i++)
|
||||
{
|
||||
CMeshO::PerFaceAttributeHandle<float> hh = tri::Allocator<CMeshO>::GetPerFaceAttribute<float>(m, AllFaceAttribName[i]);
|
||||
if(tri::Allocator<CMeshO>::IsValidHandle<float>(m,hh))
|
||||
{
|
||||
f_handlers.push_back(hh);
|
||||
f_attrNames.push_back(AllFaceAttribName[i]);
|
||||
f_attrValue.push_back(0);
|
||||
p.DefineVar(f_attrNames.back(), &f_attrValue.back());
|
||||
}
|
||||
f_handlers.push_back(hh);
|
||||
f_attrNames.push_back(AllFaceAttribName[i]);
|
||||
f_attrValue.push_back(0);
|
||||
p.DefineVar(f_attrNames.back(), &f_attrValue.back());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -357,7 +357,7 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, Ri
|
||||
case ISOP_REMESHING :
|
||||
{
|
||||
CMeshO::PerMeshAttributeHandle<IsoParametrization> isoPHandle =
|
||||
tri::Allocator<CMeshO>::GetPerMeshAttribute<IsoParametrization>(*mesh,"isoparametrization");
|
||||
tri::Allocator<CMeshO>::FindPerMeshAttribute<IsoParametrization>(*mesh,"isoparametrization");
|
||||
|
||||
bool b=tri::Allocator<CMeshO>::IsValidHandle<IsoParametrization>(*mesh,isoPHandle);
|
||||
if (!b)
|
||||
@ -399,7 +399,7 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, Ri
|
||||
case ISOP_DIAMPARAM :
|
||||
{
|
||||
CMeshO::PerMeshAttributeHandle<IsoParametrization> isoPHandle =
|
||||
tri::Allocator<CMeshO>::GetPerMeshAttribute<IsoParametrization>(*mesh,"isoparametrization");
|
||||
tri::Allocator<CMeshO>::FindPerMeshAttribute<IsoParametrization>(*mesh,"isoparametrization");
|
||||
bool b=tri::Allocator<CMeshO>::IsValidHandle<IsoParametrization>(*mesh,isoPHandle);
|
||||
if (!b)
|
||||
{
|
||||
@ -432,7 +432,7 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, Ri
|
||||
return false;
|
||||
}
|
||||
CMeshO::PerMeshAttributeHandle<IsoParametrization> isoPHandle =
|
||||
tri::Allocator<CMeshO>::GetPerMeshAttribute<IsoParametrization>(*mesh,"isoparametrization");
|
||||
tri::Allocator<CMeshO>::FindPerMeshAttribute<IsoParametrization>(*mesh,"isoparametrization");
|
||||
|
||||
bool b=tri::Allocator<CMeshO>::IsValidHandle<IsoParametrization>(*mesh,isoPHandle);
|
||||
if (!b)
|
||||
@ -456,7 +456,7 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, Ri
|
||||
{
|
||||
m->updateDataMask(MeshModel::MM_VERTQUALITY);
|
||||
CMeshO::PerMeshAttributeHandle<IsoParametrization> isoPHandle =
|
||||
tri::Allocator<CMeshO>::GetPerMeshAttribute<IsoParametrization>(*mesh,"isoparametrization");
|
||||
tri::Allocator<CMeshO>::FindPerMeshAttribute<IsoParametrization>(*mesh,"isoparametrization");
|
||||
|
||||
bool b=tri::Allocator<CMeshO>::IsValidHandle<IsoParametrization>(*mesh,isoPHandle);
|
||||
if (!b)
|
||||
@ -481,7 +481,7 @@ bool FilterIsoParametrization::applyFilter(QAction *filter, MeshDocument& md, Ri
|
||||
CMeshO *srcMesh=&mmsrc->cm;
|
||||
|
||||
CMeshO::PerMeshAttributeHandle<IsoParametrization> isoPHandle =
|
||||
tri::Allocator<CMeshO>::GetPerMeshAttribute<IsoParametrization>(*mesh,"isoparametrization");
|
||||
tri::Allocator<CMeshO>::FindPerMeshAttribute<IsoParametrization>(*mesh,"isoparametrization");
|
||||
|
||||
bool b=tri::Allocator<CMeshO>::IsValidHandle<IsoParametrization>(*srcMesh,isoPHandle);
|
||||
if (!b)
|
||||
|
||||
@ -454,7 +454,7 @@ typename MeshType::ScalarType EstimateAreaByParam
|
||||
typedef typename MeshType::VertexType VertexType;
|
||||
typedef typename MeshType::ScalarType ScalarType;
|
||||
|
||||
//MeshType::PerVertexAttributeHandle<AuxiliaryVertData> handle = vcg::tri::Allocator<MeshType>::GetPerVertexAttribute<AuxiliaryVertData>(mesh,"AuxiliaryVertData");
|
||||
//MeshType::PerVertexAttributeHandle<AuxiliaryVertData> handle = vcg::tri::Allocator<MeshType>::GetPerVertexAttribute<AuxiliaryVertData>(mesh,"AuxiliaryVertData");
|
||||
|
||||
ScalarType estimated[2]={0,0};
|
||||
int num[2]={0,0};
|
||||
|
||||
@ -445,7 +445,7 @@ bool FilterUnsharp::applyFilter(QAction *filter, MeshDocument &md, RichParameter
|
||||
errorMessage = "Failed to retrieve the stored vertex position. First Store than recover.";
|
||||
return false;
|
||||
}
|
||||
CMeshO::PerVertexAttributeHandle<Point3f> h = tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f> (m.cm,AttribName);
|
||||
CMeshO::PerVertexAttributeHandle<Point3f> h = tri::Allocator<CMeshO>::GetPerVertexAttribute<Point3f> (m.cm,AttribName);
|
||||
|
||||
CMeshO::VertexIterator vi;
|
||||
for(vi= m.cm.vert.begin();vi!= m.cm.vert.end();++vi)
|
||||
|
||||
@ -548,10 +548,10 @@ void OcmeEditPlugin::drop(){
|
||||
|
||||
void OcmeEditPlugin::markEditable(){
|
||||
CMeshO:: PerVertexAttributeHandle<unsigned char> lockedV =
|
||||
vcg::tri::Allocator<CMeshO>:: GetPerVertexAttribute<unsigned char> (mm->cm,"ocme_locked");
|
||||
vcg::tri::Allocator<CMeshO>:: GetPerVertexAttribute<unsigned char> (mm->cm,"ocme_locked");
|
||||
|
||||
CMeshO:: PerFaceAttributeHandle<unsigned char> lockedF =
|
||||
vcg::tri::Allocator<CMeshO>:: GetPerFaceAttribute<unsigned char> (mm->cm,"ocme_locked");
|
||||
vcg::tri::Allocator<CMeshO>:: GetPerFaceAttribute<unsigned char> (mm->cm,"ocme_locked");
|
||||
|
||||
for(CMeshO::VertexIterator vi = mm->cm.vert.begin(); vi != mm->cm.vert.end(); ++vi )
|
||||
if(!(*vi).IsD())
|
||||
@ -640,7 +640,7 @@ void OcmeEditPlugin::edit(){
|
||||
vcg::tri::UpdateNormals<CMeshO>::PerVertexPerFace ( mm->cm );
|
||||
|
||||
CMeshO:: PerFaceAttributeHandle<GIndex> gposf =
|
||||
vcg::tri::Allocator<CMeshO>:: GetPerFaceAttribute<GIndex> (mm->cm,"ocme_gindex");
|
||||
vcg::tri::Allocator<CMeshO>:: GetPerFaceAttribute<GIndex> (mm->cm,"ocme_gindex");
|
||||
|
||||
if(!mm->cm.face.IsColorEnabled())
|
||||
mm->cm.face.EnableColor();
|
||||
|
||||
@ -97,24 +97,24 @@ void OCME::Commit(MeshType & m, AttributeMapper attr_map){
|
||||
assert(vcg::tri::Allocator<MeshType>::IsValidHandle(m,gPosV));
|
||||
|
||||
typename MeshType::template PerFaceAttributeHandle<GIndex> gPosF =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<GIndex> (m,"ocme_gindex");
|
||||
vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<GIndex> (m,"ocme_gindex");
|
||||
assert(vcg::tri::Allocator<MeshType>::IsValidHandle(m,gPosF));
|
||||
|
||||
typename MeshType::template PerMeshAttributeHandle<ScaleRange> srE =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute<ScaleRange> (m,"ocme_range");
|
||||
vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute<ScaleRange> (m,"ocme_range");
|
||||
|
||||
assert(vcg::tri::Allocator<MeshType>::IsValidHandle(m,srE));
|
||||
|
||||
typename MeshType::template PerVertexAttributeHandle<unsigned char> lockedV =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<unsigned char> (m,"ocme_locked");
|
||||
vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<unsigned char> (m,"ocme_locked");
|
||||
assert(vcg::tri::Allocator<MeshType>::IsValidHandle(m,lockedV));
|
||||
|
||||
typename MeshType::template PerFaceAttributeHandle<unsigned char> lockedF =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<unsigned char> (m,"ocme_locked");
|
||||
vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<unsigned char> (m,"ocme_locked");
|
||||
assert(vcg::tri::Allocator<MeshType>::IsValidHandle(m,lockedF));
|
||||
|
||||
typename MeshType::template PerMeshAttributeHandle<std::vector<CellKey> > sel_cells_attr =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute<std::vector<CellKey> > (m,"sel_cells");
|
||||
vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute<std::vector<CellKey> > (m,"sel_cells");
|
||||
assert(vcg::tri::Allocator<MeshType>::IsValidHandle(m,sel_cells_attr));
|
||||
|
||||
|
||||
|
||||
@ -174,49 +174,28 @@ m.face.EnableColor();
|
||||
typename MeshType::template PerVertexAttributeHandle<GISet> gPosV =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<GISet> (m,"ocme_gindex");
|
||||
|
||||
if(!vcg::tri::Allocator<MeshType>::IsValidHandle(m,gPosV))
|
||||
gPosV = vcg::tri::Allocator<MeshType>::template AddPerVertexAttribute<GISet> (m,"ocme_gindex");
|
||||
|
||||
// create an attibute that will store the address in ocme for the vertex
|
||||
typename MeshType::template PerVertexAttributeHandle<unsigned int> biV =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<unsigned int> (m,"bi");
|
||||
if(!vcg::tri::Allocator<MeshType>::IsValidHandle(m,biV))
|
||||
biV = vcg::tri::Allocator<MeshType>::template AddPerVertexAttribute<unsigned int> (m,"bi");
|
||||
|
||||
// create an attibute that will store if the vertex is locked or not
|
||||
typename MeshType::template PerVertexAttributeHandle<unsigned char> lockedV =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<unsigned char> (m,"ocme_locked");
|
||||
|
||||
if(!vcg::tri::Allocator<MeshType>::IsValidHandle(m,lockedV))
|
||||
lockedV = vcg::tri::Allocator<MeshType>::template AddPerVertexAttribute<unsigned char> (m,"ocme_locked");
|
||||
vcg::tri::Allocator<MeshType>::template GetPerVertexAttribute<unsigned char> (m,"ocme_locked");
|
||||
|
||||
// create an attibute that will store the address in ocme for the face
|
||||
typename MeshType::template PerFaceAttributeHandle<GIndex> gPosF =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<GIndex> (m,"ocme_gindex");
|
||||
|
||||
if(!vcg::tri::Allocator<MeshType>::IsValidHandle(m,gPosF) )
|
||||
gPosF = vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<GIndex> (m,"ocme_gindex");
|
||||
vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<GIndex> (m,"ocme_gindex");
|
||||
|
||||
// create an attibute that will store if the face is locked or not
|
||||
typename MeshType::template PerFaceAttributeHandle<unsigned char> lockedF =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<unsigned char> (m,"ocme_locked");
|
||||
|
||||
if(!vcg::tri::Allocator<MeshType>::IsValidHandle(m,lockedF) )
|
||||
lockedF = vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<unsigned char> (m,"ocme_locked");
|
||||
vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<unsigned char> (m,"ocme_locked");
|
||||
|
||||
// create an attibute that will store the ScaleRange of the mesh
|
||||
typename MeshType::template PerMeshAttributeHandle<ScaleRange> range =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute<ScaleRange> (m,"ocme_range");
|
||||
|
||||
if(!vcg::tri::Allocator<MeshType>::IsValidHandle(m,range))
|
||||
range = vcg::tri::Allocator<MeshType>::template AddPerMeshAttribute<ScaleRange> (m,"ocme_range");
|
||||
|
||||
vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute<ScaleRange> (m,"ocme_range");
|
||||
|
||||
typename MeshType::template PerMeshAttributeHandle<std::vector<CellKey> > sel_cells_attr =
|
||||
vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute< std::vector<CellKey > > (m,"sel_cells");
|
||||
if(!vcg::tri::Allocator<MeshType>::IsValidHandle(m,sel_cells_attr))
|
||||
sel_cells_attr = vcg::tri::Allocator<MeshType>::template AddPerMeshAttribute<std::vector<CellKey> > (m,"sel_cells");
|
||||
|
||||
vcg::tri::Allocator<MeshType>::template GetPerMeshAttribute< std::vector<CellKey > > (m,"sel_cells");
|
||||
|
||||
|
||||
ScaleRange sr;
|
||||
|
||||
@ -173,12 +173,8 @@ public:
|
||||
|
||||
// tte an attibute that will store the address in ocme for the vertex
|
||||
attr_r = vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<int*> (*m,"r");
|
||||
if(!vcg::tri::Allocator<MeshType>::IsValidHandle(*m,attr_r))
|
||||
attr_r = vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<int*> (*m,"r");
|
||||
|
||||
attr_r_old = vcg::tri::Allocator<MeshType>::template GetPerFaceAttribute<int*> (*m,"r_old");
|
||||
if(!vcg::tri::Allocator<MeshType>::IsValidHandle(*m,attr_r_old))
|
||||
attr_r_old = vcg::tri::Allocator<MeshType>::template AddPerFaceAttribute<int*> (*m,"r_old");
|
||||
|
||||
regions.clear();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user