当前位置: 首页>>代码示例>>C++>>正文


C++ RenderSystem::getConfigOptions方法代码示例

本文整理汇总了C++中ogre::RenderSystem::getConfigOptions方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderSystem::getConfigOptions方法的具体用法?C++ RenderSystem::getConfigOptions怎么用?C++ RenderSystem::getConfigOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ogre::RenderSystem的用法示例。


在下文中一共展示了RenderSystem::getConfigOptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: update

    void GameSettings::update()
    {
        Root* root = Ogre::Root::getSingletonPtr();
        
		Ogre::RenderSystem* renderer = root->getRenderSystem();

#if OGRE_VERSION_MINOR == 7 || OGRE_VERSION_MINOR == 8
        const RenderSystemList& renderers = root->getAvailableRenderers();
#else 
        const RenderSystemList renderers = *root->getAvailableRenderers();
#endif        
        createElements(mVideoRenderer, renderers.size());

        for (unsigned int i = 0; i < renderers.size(); ++i)
        {
			Ogre::RenderSystem* cur = renderers[i];
            ListboxItem* item = mVideoRenderer->getListboxItemFromIndex(i);
            item->setText(cur->getName());
            if (cur == renderer)
            {
                mVideoRenderer->setItemSelectState(item, true);
            }
        }
        
        ConfigOptionMap config = renderer->getConfigOptions();
        
        setOption(config, "Full Screen", mVideoFullscreen);
        std::vector<RadioButton*> videoColorDepth;
        videoColorDepth.push_back(mVideoColorDepth32);
        videoColorDepth.push_back(mVideoColorDepth16);
        
        setOption(config, "Colour Depth", videoColorDepth);
        std::vector<RadioButton*> videoAntiAliasing;
        videoAntiAliasing.push_back(mVideoFsaa0);
        videoAntiAliasing.push_back(mVideoFsaa2);
        videoAntiAliasing.push_back(mVideoFsaa4);
        videoAntiAliasing.push_back(mVideoFsaa8);
        setOption(config, "FSAA", videoAntiAliasing);
        
		std::vector<RadioButton*> videoRttMode;
        videoRttMode.push_back(mVideoRttModeFBO);
        videoRttMode.push_back(mVideoRttModePBuffer);
        videoRttMode.push_back(mVideoRttModeCopy);
        setOption(config, "RTT Preferred Mode", videoRttMode);
        
        setOption(config, "Video Mode", mVideoResolution);
    }
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:47,代码来源:GameSettings.cpp

示例2: UpdateControls

void CLASS::UpdateControls()
{

	int valuecounter = 0; // Going to be usefull for selections

	//Lang (Still not done)
	if (!IsLoaded)
	{
		m_lang->addItem("English (U.S.)");
	}
	m_lang->setIndexSelected(0); //TODO

	if (!IsLoaded)
	{
		m_gearbox_mode->addItem("Automatic shift");
		m_gearbox_mode->addItem("Manual shift - Auto clutch");
		m_gearbox_mode->addItem("Fully Manual: sequential shift");
		m_gearbox_mode->addItem("Fully Manual: stick shift");
		m_gearbox_mode->addItem("Fully Manual: stick shift with ranges");
	}

	//Gearbox
	Ogre::String gearbox_mode = GameSettingsMap["GearboxMode"];
	if (gearbox_mode == "Manual shift - Auto clutch")
		m_gearbox_mode->setIndexSelected(1);
	else if (gearbox_mode == "Fully Manual: sequential shift")
		m_gearbox_mode->setIndexSelected(2);
	else if (gearbox_mode == "Fully Manual: stick shift")
		m_gearbox_mode->setIndexSelected(3);
	else if (gearbox_mode == "Fully Manual: stick shift with ranges")
		m_gearbox_mode->setIndexSelected(4);
	else
		m_gearbox_mode->setIndexSelected(0);


	Ogre::RenderSystem* rs = Ogre::Root::getSingleton().getRenderSystem();
	// add all rendersystems to the list
	if (m_render_sys->getItemCount() == 0)
	{
		const Ogre::RenderSystemList list = Application::GetOgreSubsystem()->GetOgreRoot()->getAvailableRenderers();
		int selection = 0;
		for (Ogre::RenderSystemList::const_iterator it = list.begin(); it != list.end(); it++, valuecounter++)
		{
			if (rs && rs->getName() == (*it)->getName())
			{
				ExOgreSettingsMap["Render System"] = rs->getName();
				selection = valuecounter;
			}
			else if (!rs) {
				LOG("Error: No Ogre Render System found");
			}
			if (!IsLoaded)
			{
				m_render_sys->addItem(Ogre::String((*it)->getName()));
			}
		}
		m_render_sys->setIndexSelected(selection);
	}

	Ogre::ConfigFile cfg;
	cfg.load(SSETTING("ogre.cfg", "ogre.cfg"));

	//Few GameSettingsMap
	Ogre::String bFullScreen = cfg.getSetting("Full Screen", rs->getName());
	if (bFullScreen == "Yes")
	{
		ExOgreSettingsMap["Full Screen"] = "Yes";
		m_fullscreen->setStateCheck(true);
	}
	else
	{
		ExOgreSettingsMap["Full Screen"] = "No";
		m_fullscreen->setStateCheck(false);
	}

	Ogre::String bVsync = cfg.getSetting("VSync", rs->getName());
	if (bVsync == "Yes")
	{
		ExOgreSettingsMap["VSync"] = "Yes";
		m_vsync->setStateCheck(true);
	}
	else
	{
		ExOgreSettingsMap["VSync"] = "No";
		m_vsync->setStateCheck(false);
	}
		
	// store available rendering devices and available resolutions
	Ogre::ConfigOptionMap& CurrentRendererOptions = rs->getConfigOptions();
	Ogre::ConfigOptionMap::iterator configItr = CurrentRendererOptions.begin();
	Ogre::StringVector mFoundResolutions;
	Ogre::StringVector mFoundFSAA;
	while (configItr != CurrentRendererOptions.end())
	{
		if ((configItr)->first == "Video Mode")
		{
			// Store Available Resolutions
			mFoundResolutions = ((configItr)->second.possibleValues);
		}
		if ((configItr)->first == "FSAA")
//.........这里部分代码省略.........
开发者ID:uvbs,项目名称:rigs-of-rods,代码行数:101,代码来源:GUI_GameSettings.cpp

示例3: initOgre

void App::initOgre()
{
	// Config file class is an utility that parses and stores values from a .cfg file
	Ogre::ConfigFile cf;
	std::string configFilePathPrefix = "cfg/";			// configuration files default location when app is installed
#ifdef _DEBUG
	std::string pluginsFileName = "plugins_d.cfg";		// plugins config file name (Debug mode)
#else
	std::string pluginsFileName = "plugins.cfg";		// plugins config file name (Release mode)
#endif
	std::string resourcesFileName = "resources.cfg";	// resources config file name (Debug/Release mode)


	// LOAD OGRE PLUGINS
	// Try to load load up a valid config file (and don't start the program if none is found)
	try
	{
		//This will work ONLY when application is installed (only Release application)!
		cf.load(configFilePathPrefix + pluginsFileName);
	}
	catch (Ogre::FileNotFoundException &e)
	{
		try
		{
			// if no existing config, or could not restore it, try to load from a different location
			configFilePathPrefix = "../cfg/";

			//This will work ONLY when application is in development (Debug/Release configuration)
			cf.load(configFilePathPrefix + pluginsFileName);			
		}
		catch (Ogre::FileNotFoundException &e)
		{
			// launch exception if no valid config file is found! - PROGRAM WON'T START!
			throw e;
		}
	}


	// INSTANCIATE OGRE ROOT (IT INSTANCIATES ALSO ALL OTHER OGRE COMPONENTS)
	// In Ogre, the singletons are instanciated explicitly (with new) the first time,
	// then it can be accessed with Ogre::Root::getSingleton()
	// Plugins are passed as argument to the "Root" constructor
	mRoot = new Ogre::Root(configFilePathPrefix + pluginsFileName, configFilePathPrefix + "ogre.cfg", "ogre.log");
	// No Ogre::FileNotFoundException is thrown by this, that's why we tried to open it first with ConfigFile::load()

	
	// LOAD OGRE RESOURCES
	// Load up resources according to resources.cfg ("cf" variable is reused)
	try
	{
		//This will work ONLY when application is installed!
		cf.load("cfg/resources.cfg");
	}
	catch (Ogre::FileNotFoundException &e)	// It works, no need to change anything
	{
		try
		{
			//This will work ONLY when application is in development (Debug/Release configuration)
			cf.load("../cfg/resources.cfg");
		}
		catch (Ogre::FileNotFoundException &e)
		{
			// launch exception if no valid config file is found! - PROGRAM WON'T START!
			throw e;
		}
	}

    // Go through all sections & settings in the file
    Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
    Ogre::String secName, typeName, archName;
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey(); Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
        Ogre::ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
			//For each section/key-value, add a resource to ResourceGroupManager
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
        }
	}


	// Then setup THIS CLASS INSTANCE as a frame listener
	// This means that Ogre will call frameStarted(), frameRenderingQueued() and frameEnded()
	// automatically and periodically if defined in this class
	mRoot->addFrameListener(this);


	// SELECT AND CUSTOMIZE OGRE RENDERING (OpenGL)
	// Get a reference of the RenderSystem in Ogre that I want to customize
	Ogre::RenderSystem* pRS = mRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
	// Get current config RenderSystem options in a ConfigOptionMap
	Ogre::ConfigOptionMap cfgMap = pRS->getConfigOptions();
	// Modify them
	cfgMap["Full Screen"].currentValue = "No";
	cfgMap["VSync"].currentValue = "Yes";
	#ifdef _DEBUG
//.........这里部分代码省略.........
开发者ID:fakkoweb,项目名称:OgreOculusApp,代码行数:101,代码来源:App.cpp

示例4: initOgre

void App::initOgre()
{
#ifdef _DEBUG
    mRoot = new Ogre::Root("plugins_d.cfg");
#else
    mRoot = new Ogre::Root("plugins.cfg");
#endif
    mRoot->addFrameListener(this);

    // Load up resources according to resources.cfg:
    Ogre::ConfigFile cf;
    cf.load("resources.cfg");

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

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

    Ogre::RenderSystem* pRS = mRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
    Ogre::ConfigOptionMap cfgMap = pRS->getConfigOptions();
    cfgMap["Full Screen"].currentValue = "No";
    cfgMap["VSync"].currentValue = "Yes";
#ifdef _DEBUG
    cfgMap["FSAA"].currentValue = "0";
#else
    cfgMap["FSAA"].currentValue = "8";
#endif
    cfgMap["Video Mode"].currentValue = "1200 x 800";
    for(Ogre::ConfigOptionMap::iterator iter = cfgMap.begin(); iter != cfgMap.end(); iter++) pRS->setConfigOption(iter->first, iter->second.currentValue);
    mRoot->setRenderSystem(pRS);
    mRoot->initialise(false, "Oculus Rift Visualization");

    // Create the Windows:
    Ogre::NameValuePairList miscParams;
    if( NO_RIFT )
        miscParams["monitorIndex"] = Ogre::StringConverter::toString(0);
    else
        miscParams["monitorIndex"] = Ogre::StringConverter::toString(1);
    miscParams["border "] = "none";

    Ogre::NameValuePairList miscParamsSmall;
    miscParamsSmall["monitorIndex"] = Ogre::StringConverter::toString(0);

    if( !ROTATE_VIEW )
        mWindow = mRoot->createRenderWindow("ShowARoom", WIDTH, HEIGHT, FULL_SCREEN, &miscParams);
    //mWindow = mRoot->createRenderWindow("Oculus Rift Liver Visualization", 1920*0.5, 1080*0.5, false, &miscParams);
    else
        mWindow = mRoot->createRenderWindow("ShowARoom", HEIGHT, WIDTH, FULL_SCREEN, &miscParams);

    if( DEBUG_WINDOW )
        mSmallWindow = mRoot->createRenderWindow("DEBUG ShowARoom", 1920*debugWindowSize, 1080*debugWindowSize, false, &miscParamsSmall);

    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}
开发者ID:lilyrae,项目名称:ShowARoom,代码行数:67,代码来源:App.cpp


注:本文中的ogre::RenderSystem::getConfigOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。