コード例 #1
0
ファイル: AppFrame.cpp プロジェクト: dzw/kylin001v
	KBOOL AppFrame::LoadResources()
	{
		// Load resource paths from config file
		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);
			}
		}

		return true;
コード例 #2
0
//  Resources
//-------------------------------------------------------------------------------------
void BaseApp::setupResources()
{
	//  Load resource paths from config file
	Ogre::ConfigFile cf;
	std::string s = PATHMANAGER::GameConfigDir() +
		(pSet->tex_size > 0 ? "/resources_ed.cfg" : "/resources_s_ed.cfg");
	cf.load(s);

	//  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(
				PATHMANAGER::Data() + "/" + archName, typeName, secName);
		}
	}
}
コード例 #3
0
	void GraphicsManager::setupResources(void) 
	{
		Ogre::ConfigFile cf;
		cf.load(RESOURCE_CONFIG);
		
		Ogre::ConfigFile::SectionIterator itSection = cf.getSectionIterator();
		
		Ogre::String section, type, arch;
		while (itSection.hasMoreElements()) {
			section = itSection.peekNextKey();
			Ogre::ConfigFile::SettingsMultiMap* mapSettings = itSection.getNext();
			Ogre::ConfigFile::SettingsMultiMap::iterator itSettings = mapSettings->begin();
			while (itSettings != mapSettings->end()) {
				type = itSettings->first;
				arch = itSettings->second;
				
				Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch, type, section);
				
				++itSettings;
			}
		}
		
		Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
		
		return;
	}
コード例 #4
0
void GeneralInitialization::InitializeProgram()
{
	Ogre::ConfigFile configFile;
	Ogre::String secName;
	Ogre::String typeName;
	Ogre::String archName;

#ifdef _DEBUG
	root = new Ogre::Root(Data::pluginsCfg_d);
	configFile.load(Data::resourcesCfg_d);
#else
	root = new Ogre::Root(Data::pluginsCfg);
	configFile.load(Data::resourcesCfg);
#endif

	Ogre::ConfigFile::SectionIterator sectIter = configFile.getSectionIterator();
	while (sectIter.hasMoreElements())
	{
		secName = sectIter.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = sectIter.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);
		}
	}
}
コード例 #5
0
//-------------------------------------------------------------------------------------
void BaseApplication::setupResources(void)
{
    // Load resource paths from config file
    Ogre::ConfigFile cf;
    cf.load(mResourcesCfg);

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

#if (OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS)
    Ogre::String bunPath = Ogre::macBundlePath() ;
    bunPath.push_back( '/' ) ;
#endif
    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;
#if (OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS)
            archName = bunPath + i->second;
#else
            archName = i->second;
#endif
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
        }
    }
}
コード例 #6
0
ファイル: ogreengine.cpp プロジェクト: Alexpux/QmlOgre
void OgreEngine::setupResources(void)
{
    // Load resource paths from config file
    Ogre::ConfigFile cf;
    cf.load(m_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::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}
コード例 #7
0
//-------------------------------------------------------------------------------------
void BaseApplication::setupResources(void)
{


    // Load resource paths from config file
    Ogre::ConfigFile cf;
    cf.load(mResourcesCfg);

    // 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);
        }
    }

    // create the yarp ports
    inYarpSceneObjsPort.open("/ogreClient/scene/in");
   
}
コード例 #8
0
ファイル: Samples.cpp プロジェクト: DDeimos/DeimosSpace
void CSamples::Load()
{
	Ogre::ConfigFile cf;
#ifdef _DEBUG
	cf.load("samples_d.cfg");
#else
	cf.load("samples.cfg");
#endif

	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
	Ogre::String secName, typeName, archName;

	while (seci.hasMoreElements())
	{
		secName = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();

		for (Ogre::ConfigFile::SettingsMultiMap::iterator i = settings->begin(); i != settings->end(); ++i)
		{
			if (i->first == "StartSample")
			{
				m_app = GetSampleObject(i->second);

				if (m_app != 0)
				{
					RunStartSample();
				}
			}
		}
	}
}
コード例 #9
0
ファイル: scene_manager.cpp プロジェクト: jmecosta/Navlaser3
//-------------------------------------------------------------------------------------
void THIS::setupResources(void)
{
    cout << "<TRACE><LOG><SceneManager><setupResources>  " << endl;

    // Load resource paths from config file
    Ogre::ConfigFile cf;
    cf.load(mResourcesCfg);

    // 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);
        }
    }
}
コード例 #10
0
ファイル: tracker_renderer.cpp プロジェクト: CoffeRobot/fato
void TrackerRenderer::setupResources(void) {
  // Load resource paths from config file
  Ogre::ConfigFile cf;
  cf.load(mResourcesCfg);

  std::string package_path =
      ros::package::getPath(ROS_PACKAGE_NAME) + +"/ogre_media/";

  // 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;
      archName = package_path + archName;

      Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
          archName, typeName, secName);
    }
  }
}
コード例 #11
0
void OneLeftApplication::SetupResources() {
    Ogre::ConfigFile config;

    config.load("resources.cfg");

    Ogre::ConfigFile::SectionIterator section_iterator =
        config.getSectionIterator();

    Ogre::String section_name, type_name, arch_name;

    while (section_iterator.hasMoreElements()) {
        section_name = section_iterator.peekNextKey();

        Ogre::ConfigFile::SettingsMultiMap* settings =
            section_iterator.getNext();
        Ogre::ConfigFile::SettingsMultiMap::iterator iterator;

        for (iterator = settings->begin();
                iterator != settings->end();
                ++iterator) {

            type_name = iterator->first;
            arch_name = iterator->second;

            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
                arch_name, type_name, section_name);
        }
    }
}
コード例 #12
0
ファイル: GameManager.cpp プロジェクト: andrewfenn/Hardwar
void GameManager::preloadResources()
{
    /* Load resource paths from config file */
    Ogre::ConfigFile cf;
    cf.load("resources.cfg");

    /* go through all settings in the file */
    Ogre::ConfigFile::SectionIterator itSection = cf.getSectionIterator();

    Ogre::String sSection, sType, sArch;
    while(itSection.hasMoreElements())
    {
        sSection = itSection.peekNextKey();

        Ogre::ConfigFile::SettingsMultiMap *mapSettings = itSection.getNext();
        Ogre::ConfigFile::SettingsMultiMap::iterator itSetting = mapSettings->begin();
        while(itSetting != mapSettings->end())
        {
            sType = itSetting->first;
            sArch = itSetting->second;
            mRoot->addResourceLocation(sArch, sType, sSection);
            ++itSetting;
        }
    }

    /* Initialise resources */
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}
コード例 #13
0
ファイル: GameApp.cpp プロジェクト: coneo/TankWar
bool GameApp::SetupResources()
{
    // load resources
    Ogre::String secName, typeName, archName;
    Ogre::ConfigFile cf;
    cf.load("resources_d.cfg");

    Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
    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::TextureManager::getSingleton().setDefaultNumMipmaps(5);
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

    return true;
}
コード例 #14
0
//------------------------------------------------------------------------------
bool wxOgreResources::LoadResourceFile(const Ogre::String& file)
{
    Ogre::ConfigFile cf;
    cf.load(file);
    Ogre::ConfigFile::SectionIterator it = cf.getSectionIterator();

    Ogre::String location, type, group;
    while (it.hasMoreElements()) {
        group = it.peekNextKey();
        Ogre::ConfigFile::SettingsMultiMap *settings = it.getNext();
        Ogre::ConfigFile::SettingsMultiMap::iterator i;

        for (i = settings->begin(); i != settings->end(); ++i) {
            type = i->first;
            location = i->second;

            try {
                m_rmgr->addResourceLocation(location, type, group);
            } catch (Ogre::Exception& e) {
                wxOgreExceptionBox(e);
                return false;
            }
        }
    }

    return true;
}
コード例 #15
0
    void OgreInitializer::parseResourcesConfig(const Ogre::String &name)
    {
        mResourcesFile = name;
        Ogre::ConfigFile cf;
        cf.load(mResourcesPath + name);
        // 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;

                #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_IPHONE
                                if (!Ogre::StringUtil::startsWith(archName, "/", false)) // only adjust relative dirs
                                    archName = Ogre::String(Ogre::macBundlePath() + "/" + archName);
                #endif

                Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
            }
        }
    }
コード例 #16
0
ファイル: Server.cpp プロジェクト: JOSE89/DamnedSunset
	void CServer::setupOgreResources()
	{
		//////////////////
		// OGRE         //
		//////////////////

		// Carga las rutas de los recursos desde el archivo de configuración
		Ogre::ConfigFile cf;
		cf.load("resources.cfg");

		// Examina todos los ajustes en el archivo 
		Ogre::ConfigFile::SectionIterator itSection = cf.getSectionIterator();

		std::string sSection, sType, sArch;
		while(itSection.hasMoreElements()) 
		{
			sSection = itSection.peekNextKey();

			Ogre::ConfigFile::SettingsMultiMap *mapSettings = itSection.getNext();
			Ogre::ConfigFile::SettingsMultiMap::const_iterator itSetting = mapSettings->begin();
			while(itSetting != mapSettings->end()) 
			{
				sType = itSetting->first;
				sArch = itSetting->second;

				Ogre::ResourceGroupManager::getSingleton().
						addResourceLocation(sArch, sType, sSection);

				++itSetting;
			}
		}

	} // setupResources
コード例 #17
0
ファイル: Game.cpp プロジェクト: adasm/frail-htn
void Game::loadOgreResources()
{
    // Loads all defined ogre resources (meshes, materials etc); not ok for for lots of content
    Ogre::ConfigFile config_file;
    config_file.load("resources.cfg");

    Ogre::ConfigFile::SectionIterator sec_iter = config_file.getSectionIterator();

    Ogre::String sec_name, type_name, arch_name;
    while (sec_iter.hasMoreElements())
    {
        sec_name = sec_iter.peekNextKey();

        Ogre::ConfigFile::SettingsMultiMap* settings = sec_iter.getNext();
        Ogre::ConfigFile::SettingsMultiMap::iterator iter;

        for (iter = settings->begin(); iter != settings->end(); ++iter)
        {
            type_name = iter->first;
            arch_name = iter->second;

            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
                arch_name, type_name, sec_name);
        }
    }

    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}
コード例 #18
0
ファイル: main.cpp プロジェクト: sempuki/code
void Ogre3DApplication::setup_resources ()
{
    Ogre::String sec_name, type_name, arch_name;
    Ogre::ConfigFile cf;

#ifdef Q_WS_WIN
    cf.load ("resources_win.cfg");
#elif defined Q_WS_X11
    cf.load ("resources.cfg");
#endif

    Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
    while (seci.hasMoreElements())
    {
        sec_name = seci.peekNextKey();
        Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
        Ogre::ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            type_name = i->first;
            arch_name = i->second;

            Ogre::ResourceGroupManager::getSingleton().
                addResourceLocation (arch_name, type_name, sec_name);
        }
    }
}
コード例 #19
0
ファイル: aWorldConfig.cpp プロジェクト: NickCodes/aWorld
void MyConfig::go(void)
{
	m_ConfigFile.load("aWorldOpts.cfg"); //todo is this location ok?
		
	Ogre::ConfigFile::SectionIterator seci = m_ConfigFile.getSectionIterator();
	Ogre::String sectionName;
	Ogre::String keyName;
	Ogre::String valueName;
 
	while (seci.hasMoreElements())
	{
		sectionName = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;
		
		for (i = settings->begin(); i != settings->end(); ++i)
		{
			keyName = i->first;
			valueName = i->second;
			m_Configs.insert(std::pair<std::string, std::string>(sectionName + "/" + keyName, valueName));
			
			// Debug - todo
			// Ogre::String msg2 ="m_Configs: " + m_Configs[sectionName+"/"+keyName];
			// Ogre::LogManager::getSingletonPtr()->logMessage(msg2);
		}
	}
}
コード例 #20
0
void HOO::Application::loadResources(){
	Ogre::ConfigFile cf;
	cf.load(mResourcesCfg);

	Ogre::ConfigFile::SectionIterator sectionIter = cf.getSectionIterator();
	Ogre::String sectionName, typeName, dataname;
	while (sectionIter.hasMoreElements())
	{
		sectionName = sectionIter.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = sectionIter.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;
		for (i = settings->begin(); i != settings->end(); ++i)
		{
			typeName = i->first;
			dataname = i->second;

			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
				dataname, typeName, sectionName);
		}
	}

	HOO::ResourceListener* listener = new HOO::ResourceListener();
	Ogre::ResourceGroupManager::getSingleton().addResourceGroupListener(listener);
	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}
コード例 #21
0
ファイル: OGRE.cpp プロジェクト: sw-eng-2014/general_solution
//-------------------------------------------------------------------------------------
//Load the config file and all the resources
void OGREBase::loadConfig(void)
{
	#ifdef _DEBUG
	mResourcesCfg = "resources_d.cfg";
	#else
	mResourcesCfg = "resources.cfg";
	#endif 
	//Load configFile
	Ogre::ConfigFile cf;
	cf.load(mResourcesCfg);
	// 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);
		}
	}
}
コード例 #22
0
ファイル: Editor.cpp プロジェクト: sdfwds4/ogre3d-game-editor
void CEditor::locateResources()
{
	// load resource paths from config file
	Ogre::ConfigFile cf;
	cf.load( "resources_d.cfg" );

	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
	Ogre::String sec, type, arch;

	// go through all specified resource groups
	while (seci.hasMoreElements())
	{
		sec = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;

		// go through all resource paths
		for (i = settings->begin(); i != settings->end(); i++)
		{
			type = i->first;
			arch = i->second;

			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch, type, sec);
		}
	}
}
コード例 #23
0
//---------------------------------------------------------------------------
void BaseApplication::setupResources(void)
{
    // Load resource paths from config file
    Ogre::ConfigFile cf;
    cf.load(mResourcesCfg);

    // 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;

#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
            // OS X does not set the working directory relative to the app.
            // In order to make things portable on OS X we need to provide
            // the loading with it's own bundle path location.
            if (!Ogre::StringUtil::startsWith(archName, "/", false)) // only adjust relative directories
                archName = Ogre::String(Ogre::macBundlePath() + "/" + archName);
#endif

            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
        }
    }
}
コード例 #24
0
//-------------------------------------------------------------------------------------
void BaseApplication::setupResources(void)
{
    // Load resource paths from config file
    Ogre::ConfigFile cf;
    cf.load(mResourcesCfg);

    // 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;
            std::cerr << "Ogre::ResourceGroupManager::getSingleton().addResourceLocation(" << archName << ", " << typeName << ", " << secName << ")" << std::endl;
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
        }
    }
}
コード例 #25
0
void OgreBase::InitializeRootResourcesAndPlugins()
{ 
    // construct Ogre::Root
    mRoot = new Ogre::Root(mPluginsCfg);
	
	// set up resources
	// Load resource paths from config file
	Ogre::ConfigFile cf;
	cf.load(mResourcesCfg);

	// Go through all sections & settings in the file
	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
 
	/*secName is the name of each section: Essential, Popular, General
    typeName is the type of the resource being defined: FileSystem (folder) or Zip file
    archName is an absolute path to the resource */
	Ogre::String secName, typeName, archName;
	//Loop through each section and store the location of the resource
	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);
		}
	}
}
コード例 #26
0
void gkEngine::loadResources(const gkString& name)
{
	if (name.empty()) return;

	try
	{
		Ogre::ConfigFile fp;
		fp.load(name);

		Ogre::ResourceGroupManager* resourceManager = Ogre::ResourceGroupManager::getSingletonPtr();
		Ogre::ConfigFile::SectionIterator cit = fp.getSectionIterator();

		while (cit.hasMoreElements())
		{
			gkString elementname = cit.peekNextKey();
			Ogre::ConfigFile::SettingsMultiMap* ptr = cit.getNext();
			for (Ogre::ConfigFile::SettingsMultiMap::iterator dit = ptr->begin(); dit != ptr->end(); ++dit)
				resourceManager->addResourceLocation(dit->second, dit->first, elementname);
		}
		Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
	}
	catch (Ogre::Exception& e)
	{
		gkLogMessage("Engine: Failed to load resource file!\n" << e.getDescription());
	}
}
コード例 #27
0
void Application::loadResources()
{
	// You can specify as many locations as you want, or have several resource groups that you
	// load/unload when you need.
	// You may also wish to read the resource locations from a configuration file instead of
	// having them hard-coded.
	Ogre::ResourceGroupManager& resourceManager = Ogre::ResourceGroupManager::getSingleton();
	
	Ogre::String secName, typeName, archName;
	Ogre::ConfigFile cf;
    cf.load("resources.cfg");

	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
    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);
        }
    }

	resourceManager.initialiseAllResourceGroups();
}
コード例 #28
0
ファイル: ogrewidget.cpp プロジェクト: wpfhtl/octocopter
void OgreWidget::loadResources()
{
    qDebug() << "OgreWidget::loadResources()";
    // Load resource paths from config file
    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);
        }
    }

    // Initialise, parse scripts etc
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

    qDebug() << "OgreWidget::loadResources(): done.";
}
コード例 #29
0
ファイル: graphics.cpp プロジェクト: Mononofu/OTE
void GraphicsImpl::setupResources()
{
	// Load resource paths from config file
	Ogre::ConfigFile cf;
	cf.load(resourcePath + "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;
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
			// OS X does not set the working directory relative to the app,
			// In order to make things portable on OS X we need to provide
			// the loading with it's own bundle path location
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
			 Ogre::String(macBundlePath() + "/" + archName), typeName, secName);
#else
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
			 archName, typeName, secName);
#endif
		}
	}
}
コード例 #30
0
ファイル: viewer.cpp プロジェクト: profsha/OgreViewer
void Viewer::loadResourses()
{
#if defined(Q_WS_WIN)
      Ogre::ConfigFile cf;
      cf.load("resources.cfg");
#endif

#if defined(Q_WS_X11)
      Ogre::ConfigFile cf;
      cf.load("/usr/share/OGRE/resources.cfg");
#endif

      // 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::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
}