//--------------------------------------------------------------------- void PageManager::destroyWorldSection(PagedWorldSection* coll) { PagedWorldSectionFactory* fact = getWorldSectionFactory(coll->getType()); if (fact) fact->destroyInstance(coll); else OGRE_DELETE coll; // normally a safe fallback }
//--------------------------------------------------------------------- PagedWorldSection* PageManager::createWorldSection(const String& typeName, const String& name, PagedWorld* parent, SceneManager* sm) { PagedWorldSectionFactory* fact = getWorldSectionFactory(typeName); if (!fact) OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, typeName + " is not the name of a valid PagedWorldSectionFactory", "PageManager::createWorldSection"); return fact->createInstance(name, parent, sm); }
//--------------------------------------------------------------------- PagedWorldSection* PagedWorld::createSection(SceneManager* sceneMgr, const String& typeName, const String& sectionName /*= StringUtil::BLANK*/) { String theName = sectionName; if (theName.empty()) { do { theName = mSectionNameGenerator.generate(); } while (mSections.find(theName) != mSections.end()); } else if(mSections.find(theName) != mSections.end()) { OGRE_EXCEPT(Exception::ERR_DUPLICATE_ITEM, "World section named '" + theName + "' already exists!", "PagedWorld::createSection"); } PagedWorldSection* ret = 0; if (typeName == "General") ret = OGRE_NEW PagedWorldSection(theName, this, sceneMgr); else { PagedWorldSectionFactory* fact = getManager()->getWorldSectionFactory(typeName); if (!fact) { OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, "World section type '" + typeName + "' does not exist!", "PagedWorld::createSection"); } ret = fact->createInstance(theName, this, sceneMgr); } mSections[theName] = ret; return ret; }