本文整理汇总了C++中TLeafList::ImportMesh方法的典型用法代码示例。如果您正苦于以下问题:C++ TLeafList::ImportMesh方法的具体用法?C++ TLeafList::ImportMesh怎么用?C++ TLeafList::ImportMesh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLeafList
的用法示例。
在下文中一共展示了TLeafList::ImportMesh方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
boost::shared_ptr<TriMesh>
GeometryServer::GetMesh(const string& name, const::ParameterList& parameter)
{
// try a direct match
string meshName = name;
TMeshMap::const_iterator meshIter = mMeshMap.find(meshName);
if (meshIter != mMeshMap.end())
{
return (*meshIter).second;
}
TLeafList importer;
ListChildrenSupportingClass<MeshImporter>(importer);
if (importer.size() == 0)
{
GetLog()->Error()
<< "(GeometryServer) Warning: no MeshImporter registered\n";
return boost::shared_ptr<TriMesh>();
}
// try to mangle the name
for (
TLeafList::iterator iter = importer.begin();
iter != importer.end();
++iter
)
{
boost::shared_ptr<MeshImporter> importer =
static_pointer_cast<MeshImporter>(*iter);
string str = importer->MangleName(name, parameter);
if (str != meshName)
{
meshName = str;
meshIter = mMeshMap.find(meshName);
if (meshIter != mMeshMap.end())
{
return (*meshIter).second;
}
}
}
// try to import the mesh
for (
TLeafList::iterator iter = importer.begin();
iter != importer.end();
++iter
)
{
boost::shared_ptr<MeshImporter> importer =
static_pointer_cast<MeshImporter>(*iter);
boost::shared_ptr<TriMesh> mesh = importer->ImportMesh(name,parameter);
if (mesh.get() == 0)
{
continue;
}
string meshName = mesh->GetName();
if (meshName.empty())
{
meshName = name;
mesh->SetName(name);
}
GetLog()->Debug() << "(GeometryServer) imported mesh '" << meshName
<< " with '" << importer->GetName() << "'\n";
if (mesh.get() == 0 || mesh->GetVertexCount() == 0)
{
continue;
}
RegisterMesh(mesh);
return mesh;
}
GetLog()->Error() << "(GeometryServer) ERROR: cannot import mesh '"
<< name << "'\n";
return boost::shared_ptr<TriMesh>();
}