Thursday, April 02, 2009

Ogre又卡關了…

這次卡在load資源的地方,居然跟我找不到目錄,不管是相對路徑還是絕對路徑,全部跟我說找 不 到 =口= 明明我工作目錄也設定確定正確了(不然會有一堆.dll找不到,所以這個不可能設錯")。

smgr->setAmbientLight(ColourValue(0.2f, 0.2f, 0.2f, 1.0f));
Light* pPointLight = smgr->createLight("TestPointLight");
pPointLight->setPosition(0, 0, 0);
pPointLight->setDiffuseColour(ColourValue(0.0f, 1.0f, 0.0f, 1.0f));
Entity* pEntity = smgr->createEntity("TestEntity", "./media/meshes/prototype.mesh");


你馬幫幫忙,昨天還好好的,怎麼一過了愚人節馬上開始愚起我來啦 囧

[Edit]找到該死的方法了...

// Load resource paths from config file
ConfigFile cf;
cf.load("resources.cfg");

// Go through all sections & settings in the file
ConfigFile::SectionIterator seci = cf.getSectionIterator();

String secName, typeName, archName;
while (seci.hasMoreElements())
{
secName = seci.peekNextKey();
ConfigFile::SettingsMultiMap *settings = seci.getNext();
ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); ++i)
{
typeName = i->first;
archName = i->second;
ResourceGroupManager::getSingleton().addResourceLocation(
archName, typeName, secName);
}
}

真是有夠....冏...之前之所以沒事情,完全是因為之前是使用它的ExampleApplication介面,介面裡面會自動偷偷的幫你讀取resources.cfg並且把它設定好,可是我們自己做的話並沒有小精靈會偷偷在晚上幫你把這堆code加上去,於是就....