1.一般步骤
ResourceGroupManager::addResourceLocation(dir, type, group);
...
ResourceGroupManager::intializeResourceGroup(group);
然后这个group就不能再加入资源的路径了
2.手动解析文件
http://egamesir.blog.163.com/blog/static/1880960882011739122546/
// 将新的资源搜索路径添加到resourcemanager中
std::string new_location = “c:/location/ogreres”;
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
new_location.c_str(),
"FileSystem",
"Ogre",
true);
// 手动解析脚本(以material为例)
Ogre::FileInfoListPtr fileInfoList =
Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(
"Ogre",
"*.material");
for (Ogre::FileInfoList::const_iterator cit=fileInfoList->begin();
cit != fileInfoList->end();
++cit) {
const Ogre::String& name = cit->filename;
const Ogre::String& basename = cit->basename;
Ogre::String sType = cit->archive->getType();
Ogre::String sPath = cit->archive->getName();
if (sType=="FileSystem" && sPath==new_location) {
Ogre::DataStreamPtr pData=
Ogre::ResourceGroupManager::getSingleton().openResource(
basename,"Ogre");
Ogre::MaterialManager::getSingleton().parseScript(
pData, "Ogre");
}
}
3.直接在initialize之后继续加入dir
在initialize之后想加入其他组:先clear一个组,然后在加入想加入的组(刚刚remove掉的如果需要也加加入)