Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-------------------------------------------------------------------------------------
- bool Ogre3D::setupResources(void)
- {
- // Add important resource paths
- Ogre::ResourceGroupManager::getSingleton().addResourceLocation("./Resources/SdkTrays.zip", "Zip", "Essential");
- Ogre::ResourceGroupManager::getSingleton().addResourceLocation("./Resources/Shaders", "FileSystem", "Essential");
- // Add non-important resource paths
- Ogre::ResourceGroupManager::getSingleton().addResourceLocation("./Resources/Female", "FileSystem", "General");
- // A list of required plugins
- Ogre::StringVector required_plugins;
- required_plugins.push_back("Direct3D9 Rendering Subsystem");
- required_plugins.push_back("Cg Program Manager");
- // List of plugins to load
- Ogre::StringVector plugins_toLoad;
- plugins_toLoad.push_back("Direct3D9");
- plugins_toLoad.push_back("CgProgramManager");
- // Import plugins
- for(Ogre::StringVector::iterator j = plugins_toLoad.begin(); j != plugins_toLoad.end(); j++)
- {
- mRoot->loadPlugin(*j);
- }
- // Return if the number of loaded plugins is equal to plugins to load, if not, exit the application
- Ogre::Root::PluginInstanceList ip = mRoot->getInstalledPlugins();
- // Check if the required plugins are installed and ready for use
- // If not: exit the application
- Ogre::Root::PluginInstanceList ip = mRoot->getInstalledPlugins();
- for (Ogre::StringVector::iterator j = required_plugins.begin(); j != required_plugins.end(); j++)
- {
- bool found = false;
- // try to find the required plugin in the current installed plugins
- for(Ogre::Root::PluginInstanceList::iterator k = ip.begin(); k != ip.end(); k++)
- {
- if ((*k)->getName() == *j)
- {
- found = true;
- break;
- }
- }
- if (!found) // return false because a required plugin is not available
- {
- return false;
- }
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment