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掉的如果需要也加加入)