/** Utility function for getting a pointer to 
the Spacescape Ogre plugin
@return the spacescape plugin or NULL
*/
Ogre::SpacescapePlugin* QtSpacescapeWidget::getPlugin()
{
    //std::vector<Ogre::Plugin*> pl = Ogre::Root::getSingleton().getInstalledPlugins();
	Ogre::Root::PluginInstanceList pl = Ogre::Root::getSingleton().getInstalledPlugins();
	Ogre::Root::PluginInstanceList::iterator ii = pl.begin();
    for(ii = pl.begin(); ii != pl.end(); ii++) {
        if((*ii)->getName() == "Spacescape") {
            return (Ogre::SpacescapePlugin*)(*ii);
        }
    }

    return NULL;
}
Ejemplo n.º 2
0
bool GameManager::configure(void)
{
    //// load config settings from ogre.cfg
    //if (!mRoot->restoreConfig())
    //{
    //    // if there is no config file, show the configuration dialog
    //    if (!mRoot->showConfigDialog())
    //    {
    //        return false;
    //    }
    //}
 
    //// initialise and create a default rendering window
    //mRenderWindow = mRoot->initialise(true);
 
    //ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

	// -- NEW --

	// A list of required plugins
    Ogre::StringVector required_plugins;
    required_plugins.push_back("GL RenderSystem");
   // required_plugins.push_back("Octree & Terrain Scene Manager");
 
    // List of plugins to load
    Ogre::StringVector plugins_toLoad;
    plugins_toLoad.push_back("RenderSystem_GL");
    //plugins_toLoad.push_back("Plugin_OctreeSceneManager");
 
    // Load the OpenGL RenderSystem and the Octree SceneManager plugins
    for (Ogre::StringVector::iterator j = plugins_toLoad.begin(); j != plugins_toLoad.end(); j++)
    {
#ifdef _DEBUG
        mRoot->loadPlugin(*j + Ogre::String("_d"));
#else
        mRoot->loadPlugin(*j);
#endif;
    }
 
    // 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;
        }
    }
 
////-------------------------------------------------------------------------------------
//    // setup resources
//    // Only add the minimally required resource locations to load up the Ogre head mesh
//    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../media/materials/programs", "FileSystem", "General");
//    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../media/materials/scripts", "FileSystem", "General");
//    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../media/materials/textures", "FileSystem", "General");
//    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../../media/models", "FileSystem", "General");
// 
//-------------------------------------------------------------------------------------
    // configure
    // Grab the OpenGL RenderSystem, or exit
    Ogre::RenderSystem* rs = mRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
    if(!(rs->getName() == "OpenGL Rendering Subsystem"))
    {
        return false; //No RenderSystem found
    }
    // configure our RenderSystem
    rs->setConfigOption("Full Screen", "No");
    rs->setConfigOption("VSync", "No");
    rs->setConfigOption("Video Mode", "800 x 600 @ 32-bit");
 
    mRoot->setRenderSystem(rs);
 
    mRenderWindow = mRoot->initialise(true, "LowLevelOgre Render Window");
 
    return true;
}