本文整理汇总了C++中MeshModel::Enable方法的典型用法代码示例。如果您正苦于以下问题:C++ MeshModel::Enable方法的具体用法?C++ MeshModel::Enable怎么用?C++ MeshModel::Enable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MeshModel
的用法示例。
在下文中一共展示了MeshModel::Enable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open
bool ExpeIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &parlst, CallBackPos *cb, QWidget *parent)
{
// initializing mask
mask = 0;
// initializing progress bar status
if (cb != NULL) (*cb)(0, "Loading...");
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
QString error_2MsgFormat = "Error encountered while loading file:\n\"%1\"\n\n File with more than a mesh.\n Load only the first!";
string filename = QFile::encodeName(fileName).constData ();
bool normalsUpdated = false;
if ( (formatName.toLower() == tr("pts")) || (formatName.toLower() == tr("apts")) )
{
int loadMask;
if (!vcg::tri::io::ImporterExpePTS<CMeshO>::LoadMask(filename.c_str(),loadMask))
return false;
//std::cout << "loadMask = " << loadMask << "\n";
m.Enable(loadMask);
int result = vcg::tri::io::ImporterExpePTS<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
if (result != 0)
{
QMessageBox::warning(parent, tr("Expe Point Set Opening Error"),
errorMsgFormat.arg(fileName, vcg::tri::io::ImporterExpePTS<CMeshO>::ErrorMsg(result)));
return false;
}
}
else if (formatName.toLower() == tr("xyz"))
{
int loadMask;
if (!vcg::tri::io::ImporterXYZ<CMeshO>::LoadMask(filename.c_str(),loadMask))
return false;
m.Enable(loadMask);
int result = vcg::tri::io::ImporterXYZ<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
if (result != 0)
{
QMessageBox::warning(parent, tr("XYZ Opening Error"),
errorMsgFormat.arg(fileName, vcg::tri::io::ImporterXYZ<CMeshO>::ErrorMsg(result)));
return false;
}
}
vcg::tri::UpdateBounding<CMeshO>::Box(m.cm); // updates bounding box
if (cb != NULL)
(*cb)(99, "Done");
return true;
}
示例2: delete
void FilterSSynth::openX3D(const QString &fileName, MeshModel &m, int& mask, vcg::CallBackPos *cb, QWidget* parent)
{
vcg::tri::io::AdditionalInfoX3D* info = NULL;
int result = vcg::tri::io::ImporterX3D<CMeshO>::LoadMask(fileName.toStdString().c_str(), info);
m.Enable(info->mask);
result = vcg::tri::io::ImporterX3D<CMeshO>::Open(m.cm, fileName.toStdString().c_str(), info, cb);
vcg::tri::UpdateBounding<CMeshO>::Box(m.cm);
vcg::tri::UpdateNormals<CMeshO>::PerVertexNormalizedPerFaceNormalized(m.cm);
mask=info->mask;
delete(info);
}
示例3: open
bool GtsIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &parlst, CallBackPos *cb, QWidget *parent)
{
// initializing mask
mask = 0;
// initializing progress bar status
if (cb != NULL) (*cb)(0, "Loading...");
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
QString error_2MsgFormat = "Error encountered while loading file:\n\"%1\"\n\n File with more than a mesh.\n Load only the first!";
string filename = QFile::encodeName(fileName).constData ();
bool normalsUpdated = false;
if (formatName.toUpper() == tr("GTS"))
{
int loadMask;
if (!vcg::tri::io::ImporterGTS<CMeshO>::LoadMask(filename.c_str(),loadMask))
return false;
m.Enable(loadMask);
vcg::tri::io::ImporterGTS<CMeshO>::Options opt;
opt.flipFaces = true;
int result = vcg::tri::io::ImporterGTS<CMeshO>::Open(m.cm, filename.c_str(), mask, opt, cb);
if (result != 0)
{
QMessageBox::warning(parent, tr("GTS Opening Error"),
errorMsgFormat.arg(fileName, vcg::tri::io::ImporterGTS<CMeshO>::ErrorMsg(result)));
return false;
}
CMeshO::FaceIterator fi = m.cm.face.begin();
for (; fi != m.cm.face.end(); ++fi)
face::ComputeNormalizedNormal(*fi);
}
vcg::tri::UpdateBounding<CMeshO>::Box(m.cm); // updates bounding box
if (!normalsUpdated)
vcg::tri::UpdateNormals<CMeshO>::PerVertex(m.cm); // updates normals
if (cb != NULL)
(*cb)(99, "Done");
return true;
}
示例4: open
bool BaseMeshIOPlugin::open(const QString &formatName, const QString &fileName, MeshModel &m, int& mask, const RichParameterSet &parlst, CallBackPos *cb, QWidget * /*parent*/)
{
bool normalsUpdated = false;
// initializing mask
mask = 0;
// initializing progress bar status
if (cb != NULL) (*cb)(0, "Loading...");
QString errorMsgFormat = "Error encountered while loading file:\n\"%1\"\n\nError details: %2";
//string filename = fileName.toUtf8().data();
string filename = QFile::encodeName(fileName).constData ();
if (formatName.toUpper() == tr("PLY"))
{
tri::io::ImporterPLY<CMeshO>::LoadMask(filename.c_str(), mask);
// small patch to allow the loading of per wedge color into faces.
if(mask & tri::io::Mask::IOM_WEDGCOLOR) mask |= tri::io::Mask::IOM_FACECOLOR;
m.Enable(mask);
int result = tri::io::ImporterPLY<CMeshO>::Open(m.cm, filename.c_str(), mask, cb);
if (result != 0) // all the importers return 0 on success
{
if(tri::io::ImporterPLY<CMeshO>::ErrorCritical(result) )
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterPLY<CMeshO>::ErrorMsg(result));
return false;
}
}
}
else if (formatName.toUpper() == tr("STL"))
{
int result = tri::io::ImporterSTL<CMeshO>::Open(m.cm, filename.c_str(), cb);
if (result != 0) // all the importers return 0 on success
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterSTL<CMeshO>::ErrorMsg(result));
return false;
}
}
else if( (formatName.toUpper() == tr("OBJ")) || (formatName.toUpper() == tr("QOBJ")) )
{
tri::io::ImporterOBJ<CMeshO>::Info oi;
oi.cb = cb;
if (!tri::io::ImporterOBJ<CMeshO>::LoadMask(filename.c_str(), oi))
return false;
m.Enable(oi.mask);
int result = tri::io::ImporterOBJ<CMeshO>::Open(m.cm, filename.c_str(), oi);
if (result != tri::io::ImporterOBJ<CMeshO>::E_NOERROR)
{
if (result & tri::io::ImporterOBJ<CMeshO>::E_NON_CRITICAL_ERROR)
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterOBJ<CMeshO>::ErrorMsg(result));
else
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterOBJ<CMeshO>::ErrorMsg(result));
return false;
}
}
if(oi.mask & tri::io::Mask::IOM_WEDGNORMAL)
normalsUpdated = true;
m.Enable(oi.mask);
if(m.hasDataMask(MeshModel::MM_POLYGONAL)) qDebug("Mesh is Polygonal!");
mask = oi.mask;
}
else if (formatName.toUpper() == tr("PTX"))
{
tri::io::ImporterPTX<CMeshO>::Info importparams;
importparams.meshnum = parlst.getInt("meshindex");
importparams.anglecull =parlst.getBool("anglecull");
importparams.angle = parlst.getFloat("angle");
importparams.savecolor = parlst.getBool("usecolor");
importparams.pointcull = parlst.getBool("pointcull");
importparams.pointsonly = parlst.getBool("pointsonly");
importparams.switchside = parlst.getBool("switchside");
importparams.flipfaces = parlst.getBool("flipfaces");
// if color, add to mesh
if(importparams.savecolor)
importparams.mask |= tri::io::Mask::IOM_VERTCOLOR;
if(importparams.pointsonly)
importparams.mask |= tri::io::Mask::IOM_VERTRADIUS;
// reflectance is stored in quality
importparams.mask |= tri::io::Mask::IOM_VERTQUALITY;
m.Enable(importparams.mask);
int result = tri::io::ImporterPTX<CMeshO>::Open(m.cm, filename.c_str(), importparams, cb);
if (result == 1)
{
errorMessage = errorMsgFormat.arg(fileName, tri::io::ImporterPTX<CMeshO>::ErrorMsg(result));
return false;
}
// update mask
//.........这里部分代码省略.........