简述Ogitor加载场景流程
LoadScene:
COFSSceneSerializer()->Import(FileName);
OgitorsSystem->UpdateProcess(...);
if not finished
print "Loading x% ..."
update();
else
print "OK"
update();
COFSSceneSerializer()->Import(FileName):
loadmsg = mSystem->Translate("Parsing Scene File");
mSystem->UpdateLoadProgress(1, loadmsg);
TiXmlNode* node = 0;
node = docImport.FirstChild("OGITORSCENE");
......
do //10% -> 80%, here it is!
{ ...
}while(element = element->NextSiblingElement());
ogRoot->AfterLoadScene();
return SCF_OK;
AfterLoadScene():
CreateGizmo();
mClipboardManager = OGRE_NEW OgitorsClipboardManager();
SetEditorTool(TOOL_SELECT);
GetSceneManager()->setVisibilityMask(vismask);
Ogre::UTFString loadmsg = mSystem->Translate("Loading scene objects");
mSystem->UpdateLoadProgress(80, loadmsg);
mRootEditor->load();// OgreSetup Step 7, load third party plugins and libs
mRootEditor->loadAllChildren(mPagingEditor != 0);
loadmsg = mSystem->Translate("OK!~Rendering...");
mSystem->UpdateLoadProgress(100, loadmsg);
mSelectionNode = GetSceneManager()->getRootSceneNode()->createChildSceneNode("scbnSELECTION");
mSelectionNode->setVisible(true);
...
setLoadState(LS_LOADED);
SetSceneModified(false);
return true;
-----------------------------------------------
上面那部分是从以下代码中总结出来的:
//void MainWindow::openScene() --- mainwindowactions.cpp
1、Ogitors::OgitorsRoot *ogRoot = OgitorsRoot::getSingletonPtr();获取mRoot句柄
2、int ret = ogRoot->LoadScene("");
//int OgitorsRoot::LoadScene(Ogre::String filename) --- OgitorsRoot.cpp
3、setLoadState(LS_LOADING);
4、Ogre::UTFString msg = mSystem->Translate("Load in progress...");
5、COFSSceneSerializer *defaultserializer = OGRE_NEW COFSSceneSerializer();
int ret = defaultserializer->Import(filename);
6、msg = mSystem->Translate("Please load a Scene File...");
7、mSystem->UpdateLoadProgress(-1, msg);
//void QtOgitorSystem::UpdateLoadProgress(float percentage, Ogre::UTFString msg) ---qtogitorsystem.cpp
8、if(percentage > 0)
mRenderViewWidget->setOverlayMessage(QApplication::translate("QtOgitorSystem","Loading") + QString(" %") + QString("%1").arg(percentage) + "\n" + ConvertToQString(msg));
else
mRenderViewWidget->setOverlayMessage(ConvertToQString(msg));
//void setOverlayMessage(QString msg) --- ogrewidget.hxx
9、void setOverlayMessage(QString msg)
{
mOverlayWidget->setMessageString(msg);
update();
};
//void update(); qwidget.h in Qt SDK
10、void update();
-------------------------------------------------------------
现在不能理解的是update的作用以及如何与Ogre启动流程结合起来。