mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 03:16:10 +00:00
Significant improvment of plymc filter. Now works with multiple meshes (use all the visible layers) and honors the Tr matrix.
This commit is contained in:
parent
54e9c75a07
commit
aaec7445c5
@ -117,19 +117,26 @@ bool PlyMCPlugin::applyFilter(QAction */*filter*/, MeshDocument &md, RichParamet
|
||||
|
||||
foreach(MeshModel*mm, md.meshList)
|
||||
{
|
||||
SMesh sm;
|
||||
mm->updateDataMask(MeshModel::MM_FACEQUALITY);
|
||||
tri::Append<SMesh,CMeshO>::Mesh(sm,mm->cm);
|
||||
QString mshTmpPath=QDir::tempPath()+QString("/")+QString(mm->shortName());
|
||||
qDebug("Saving tmp file %s",qPrintable(mshTmpPath));
|
||||
int retVal = tri::io::ExporterVMI<SMesh>::Save(sm,qPrintable(mshTmpPath) );
|
||||
if(retVal!=0)
|
||||
if(mm->visible)
|
||||
{
|
||||
qDebug("Failed to write vmi temp file %s",qPrintable(mshTmpPath));
|
||||
return false;
|
||||
SMesh sm;
|
||||
mm->updateDataMask(MeshModel::MM_FACEQUALITY);
|
||||
tri::Append<SMesh,CMeshO>::Mesh(sm, mm->cm);
|
||||
tri::UpdatePosition<SMesh>::Matrix(sm, mm->cm.Tr,true);
|
||||
tri::UpdateBounding<SMesh>::Box(sm);
|
||||
//QString mshTmpPath=QDir::tempPath()+QString("/")+QString(mm->shortName())+QString(".vmi");
|
||||
QString mshTmpPath=QString("__TMP")+QString(mm->shortName())+QString(".vmi");
|
||||
qDebug("Saving tmp file %s",qPrintable(mshTmpPath));
|
||||
int retVal = tri::io::ExporterVMI<SMesh>::Save(sm,qPrintable(mshTmpPath) );
|
||||
if(retVal!=0)
|
||||
{
|
||||
qDebug("Failed to write vmi temp file %s",qPrintable(mshTmpPath));
|
||||
return false;
|
||||
}
|
||||
pmc.MP.AddSingleMesh(qPrintable(mshTmpPath));
|
||||
}
|
||||
pmc.MP.AddSingleMesh(qPrintable(mshTmpPath));
|
||||
}
|
||||
|
||||
pmc.Process();
|
||||
|
||||
if(par.getBool("openResult"))
|
||||
@ -142,9 +149,9 @@ bool PlyMCPlugin::applyFilter(QAction */*filter*/, MeshDocument &md, RichParamet
|
||||
tri::UpdateNormals<CMeshO>::PerVertexPerFace(mp->cm);
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0;i<pmc.MP.size();++i)
|
||||
QFile::remove(pmc.MP.MeshName(i).c_str());
|
||||
//
|
||||
// for(int i=0;i<pmc.MP.size();++i)
|
||||
// QFile::remove(pmc.MP.MeshName(i).c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ bool AddMeshToVolumeM(SMesh &m, std::string meshname, const double w )
|
||||
|
||||
void Process()
|
||||
{
|
||||
printf("bbox scanning...\r"); fflush(stdout);
|
||||
printf("bbox scanning...\n"); fflush(stdout);
|
||||
Matrix44f Id; Id.SetIdentity();
|
||||
MP.InitBBox();
|
||||
printf("Completed BBox Scanning \n");
|
||||
|
||||
@ -138,7 +138,7 @@ int main(int argc, char *argv[])
|
||||
case 'L' : p.SmoothNum =atoi(argv[i]+2);printf("Setting Laplacian SmoothNum to %i\n",p.SmoothNum);break;
|
||||
case 'R' : p.RefillNum =atoi(argv[i]+2);printf("Setting Refilling Num to %i\n",p.RefillNum);break;
|
||||
case 'q' : p.QualitySmoothVox=atof(argv[i]+2);printf("Setting QualitySmoothThr to %f; \n",p.QualitySmoothVox);break;
|
||||
case 'Q' : p.QualitySmoothAbs=atof(argv[i]+2);printf("Setting QualitySmoothAbsolute to %f; it will override the default %i voxel value\n",p.QualitySmoothAbs,p.QualitySmoothVox);break;
|
||||
case 'Q' : p.QualitySmoothAbs=atof(argv[i]+2);printf("Setting QualitySmoothAbsolute to %f; it will override the default %f voxel value\n",p.QualitySmoothAbs,p.QualitySmoothVox);break;
|
||||
case 'l' : p.IntraSmoothFlag=true; printf("Setting Laplacian Smooth after expansion \n");break;
|
||||
case 'G' : p.GeodesicQualityFlag=false; printf("Disabling Geodesic Quality\n");break;
|
||||
case 'F' : p.PLYFileQualityFlag=true; p.GeodesicQualityFlag=false; printf("Enabling PlyFile (and disabling Geodesic) Quality\n");break;
|
||||
|
||||
@ -113,7 +113,7 @@ template<class TriMeshType>
|
||||
ALNParser::ParseALN(rmaps, alnName);
|
||||
|
||||
for(int i=0; i<rmaps.size(); i++)
|
||||
AddSingleMesh(rmaps[i].filename, rmaps[i].trasformation, rmaps[i].quality);
|
||||
AddSingleMesh(rmaps[i].filename.c_str(), rmaps[i].trasformation, rmaps[i].quality);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -160,33 +160,35 @@ template<class TriMeshType>
|
||||
fullBBox.SetNull();
|
||||
|
||||
for(int i=0;i<int(meshnames.size());++i)
|
||||
{
|
||||
{
|
||||
Box3d b;
|
||||
bool ret;
|
||||
Matrix44f mt;
|
||||
Matrix44f Id; Id.SetIdentity();
|
||||
mt.Import(TrV[i]);
|
||||
printf("bbox scanning %4i/%i [%16s] \r",i+1,(int)meshnames.size(), meshnames[i].c_str());
|
||||
printf("bbox scanning %4i/%i [%16s] \r",i+1,(int)meshnames.size(), meshnames[i].c_str());
|
||||
if(tri::io::Importer<TriMeshType>::FileExtension(meshnames[i],"PLY"))
|
||||
{
|
||||
if(!(TrV[i]==Id))
|
||||
ret=ply::ScanBBox(meshnames[i].c_str(),BBV[i],mt,true,0);
|
||||
else
|
||||
ret=vcg::ply::ScanBBox(meshnames[i].c_str(),BBV[i]);
|
||||
if( ! ret)
|
||||
{
|
||||
printf("\n\nwarning:\n file '%s' not found\n",meshnames[i].c_str());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!(TrV[i]==Id))
|
||||
ret=ply::ScanBBox(meshnames[i].c_str(),BBV[i],mt,true,0);
|
||||
else
|
||||
ret=vcg::ply::ScanBBox(meshnames[i].c_str(),BBV[i]);
|
||||
|
||||
}
|
||||
else
|
||||
{ printf("Trying to import a non-ply file %s\n",meshnames[i].c_str());fflush(stdout);
|
||||
TriMeshType m;
|
||||
tri::io::Importer<TriMeshType>::Open(m,meshnames[i].c_str());
|
||||
int retVal=tri::io::Importer<TriMeshType>::Open(m,meshnames[i].c_str());
|
||||
ret = (retVal==0);
|
||||
tri::UpdateBounding<TriMeshType>::Box(m);
|
||||
BBV[i].Import(m.bbox);
|
||||
}
|
||||
fullBBox.Add(BBV[i]);
|
||||
if( ! ret)
|
||||
{
|
||||
printf("\n\nwarning:\n file '%s' not found\n",meshnames[i].c_str());fflush(stdout);
|
||||
continue;
|
||||
}
|
||||
fullBBox.Add(BBV[i]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user