本文整理汇总了C++中ogre::FileInfoListPtr::setNull方法的典型用法代码示例。如果您正苦于以下问题:C++ FileInfoListPtr::setNull方法的具体用法?C++ FileInfoListPtr::setNull怎么用?C++ FileInfoListPtr::setNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::FileInfoListPtr
的用法示例。
在下文中一共展示了FileInfoListPtr::setNull方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
const VectorString& Ogre2DataManager::getDataListNames(const std::string& _pattern, bool _fullpath)
{
static VectorString result;
result.clear();
VectorString search;
if (mAllGroups)
{
Ogre::StringVector sp = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
search.reserve(sp.size());
for (size_t i = 0; i < sp.size(); i++)
search.push_back(sp[i]);
}
else
search.push_back(mGroup);
std::vector<Ogre::FileInfoListPtr> pFileInfos;
int resultSize = 0;
for (size_t i = 0; i < search.size(); i++)
{
Ogre::FileInfoListPtr pFileInfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(search[i], _pattern);
resultSize += pFileInfo->size();
if (!pFileInfo->empty())
pFileInfos.push_back(pFileInfo);
else
pFileInfo.setNull();
}
result.reserve(resultSize);
for (size_t i = 0; i < pFileInfos.size(); i++)
{
Ogre::FileInfoListPtr pFileInfo = pFileInfos[i];
for (Ogre::FileInfoList::iterator fi = pFileInfo->begin(); fi != pFileInfo->end(); ++fi )
{
if (fi->path.empty())
{
bool found = false;
for (VectorString::iterator iter = result.begin(); iter != result.end(); ++iter)
{
if (*iter == fi->filename)
{
found = true;
break;
}
}
if (!found)
{
result.push_back(_fullpath ? fi->archive->getName() + "/" + fi->filename : fi->filename);
}
}
}
pFileInfo.setNull();
}
return result;
}
示例2:
const VectorString& OgreDataManager::getDataListNames(const std::string& _pattern, bool _fullpath)
{
static VectorString result;
result.clear();
Ogre::FileInfoListPtr pFileInfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(mGroup, _pattern);
result.reserve(pFileInfo->size());
for (Ogre::FileInfoList::iterator fi = pFileInfo->begin(); fi != pFileInfo->end(); ++fi )
{
if (fi->path.empty())
{
bool found = false;
for (VectorString::iterator iter = result.begin(); iter != result.end(); ++iter)
{
if (*iter == fi->filename)
{
found = true;
break;
}
}
if (!found)
{
result.push_back(_fullpath ? fi->archive->getName() + "/" + fi->filename : fi->filename);
}
}
}
pFileInfo.setNull();
return result;
}
示例3: addEditorResources
//-----------------------------------------------------------------------------------------
void CTerrainGroupEditorFactory::addEditorResources(bool changeDefaultNames)
{
OgitorsRoot* ogitorsRoot = OgitorsRoot::getSingletonPtr();
Ogre::String terrainDir = ogitorsRoot->GetProjectOptions()->TerrainDirectory;
// create Terrain project folder and folder to hold the terrain
ogitorsRoot->GetProjectFile()->createDirectory(terrainDir.c_str());
ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/terrain/").c_str());
// copy default plant textures
ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/plants/").c_str());
Ogre::String copydir = Ogitors::Globals::MEDIA_PATH + "/plants/";
OgitorsUtils::CopyDirOfs(copydir, (terrainDir+"/plants/").c_str());
// copy default terrain textures sorting them into two different folders
ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/textures/").c_str());
ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/textures/diffusespecular").c_str());
ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/textures/normalheight").c_str());
Ogre::ResourceGroupManager *mngr = Ogre::ResourceGroupManager::getSingletonPtr();
copydir = Ogitors::Globals::MEDIA_PATH + "/terrainTextures/";
mngr->addResourceLocation(copydir,"FileSystem","CopyTerrain");
Ogre::FileInfoListPtr resList = mngr->listResourceFileInfo("CopyTerrain");
// copy the files to the different directories
OFS::OfsPtr& file = ogitorsRoot->GetProjectFile();
for (Ogre::FileInfoList::const_iterator it = resList->begin(); it != resList->end(); ++it)
{
Ogre::FileInfo fInfo = (*it);
Ogre::String loc = copydir + fInfo.path + fInfo.filename;
Ogre::String newName = fInfo.filename;
if(fInfo.archive->getType() == "FileSystem")
{
if(fInfo.filename.find("diffusespecular") != -1)
{
/* since we're using different resource groups for the terrain lets
remove the naming scheme from the filenames except if the project
is being upgraded, in which case leave the name alone. */
if (changeDefaultNames) {
newName = Ogre::StringUtil::replaceAll(newName, "_diffusespecular", "");
}
OgitorsUtils::CopyFileOfs(loc, terrainDir+"/textures/diffusespecular/"+newName);
}
if(fInfo.filename.find("normalheight") != -1)
{
if (changeDefaultNames) {
newName = Ogre::StringUtil::replaceAll(newName, "_normalheight", "");
}
OgitorsUtils::CopyFileOfs(loc, terrainDir+"/textures/normalheight/"+newName);
}
}
}
resList.setNull();
ogitorsRoot->DestroyResourceGroup("CopyTerrain");
}