您的位置:首页 > 产品设计 > 产品经理

ogre 资源管理 resourcegroupmanager

2012-06-13 17:44 323 查看
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掉的如果需要也加加入)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  string iterator 脚本 c