예제 #1
0
//  Resources
//-------------------------------------------------------------------------------------
void BaseApp::setupResources()
{
	// Load resource paths from config file
	Ogre::ConfigFile cf;
	std::string s = PATHMANAGER::GameConfigDir() +
		(pSet->tex_size > 0 ? "/resources.cfg" : "/resources_s.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);
	}	}
}
예제 #2
0
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();
}
예제 #3
0
//-----------------------------------------------------------------------
void
System::_setupResources(const Ogre::String& resourceFileName)
{
    // Load resource paths from config file
    Ogre::ConfigFile cf;
    cf.load(resourceFileName);

    // 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();
        const Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
        Ogre::ConfigFile::SettingsMultiMap::const_iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
            bool recursive = false;
            if (archName[0] == '*')
            {
                archName.erase(0, 1);
                Ogre::StringUtil::trim(archName);
                recursive = true;
            }
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName, recursive);
        }
    }
}
예제 #4
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);
        }
    }
}
예제 #5
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;
}
예제 #6
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;
}
예제 #7
0
파일: gkEngine.cpp 프로젝트: Ali-il/gamekit
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());
	}
}
예제 #8
0
//-------------------------------------------------------------------------------------
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);
        }
    }
}
예제 #9
0
    void OgreModule::setupResources()
    {
        // Load resource paths from config file
        Ogre::ConfigFile cf;
        cf.load(mResourcePath + "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_unique entities 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
            }
        }
    }
예제 #10
0
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();
				}
			}
		}
	}
}
예제 #11
0
    void OgreEngine::initResources() {
        // 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);
            }
        }

        Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    }
예제 #12
0
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);
    }
  }
}
예제 #13
0
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();
}
예제 #14
0
void Game::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);
		}
	}

	Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("General");
}
예제 #15
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();
}
예제 #16
0
	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
파일: 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);
        }
    }
}
예제 #18
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);
        }
    }
}
예제 #19
0
void CsBaseApplication::SetupResources(void)
{
	Ogre::String resourcesCfg;
#ifdef _DEBUG
    resourcesCfg = "resources_d.cfg";
#else
    resourcesCfg = "resources.cfg";
#endif
    // Load resource paths from config file
    Ogre::ConfigFile cf;
    cf.load(resourcesCfg);

    // 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);
        }
    }
}
예제 #20
0
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);
		}
	}
}
예제 #21
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();
}
예제 #22
0
// Initialise the Ogre3D rendering system
bool TutorialApplication::go()
{
#ifdef _DEBUG
	mResourcesCfg = "resources_d.cfg";
	mPluginsCfg = "plugins_d.cfg";
#else
	mResourcesCfg = "resources.cfg";
	mPluginsCfg = "plugins.cfg";
#endif

	mRoot = new Ogre::Root(mPluginsCfg);

	Ogre::ConfigFile cf;
	cf.load(mResourcesCfg);

	Ogre::String name, locType;

	Ogre::ConfigFile::SectionIterator secIt = cf.getSectionIterator();

	while (secIt.hasMoreElements())
	{
		Ogre::ConfigFile::SettingsMultiMap* settings = secIt.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator it;
		for (it = settings->begin(); it != settings->end(); ++it)
		{
			locType = it->first;
			name = it->second;
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(name, locType);
		}
	}

	///if(!(mRoot->restoreConfig() || mRoot->showConfigDialog()))
	//	return false;
	mRoot->showConfigDialog();


	mWindow = mRoot->initialise(true, "TutorialApplication Render Window");

	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

	// Create and Initialise the scene
	createScene();

	// Initialise OIS
	initInput();

	//Register as a Window listener
	Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);

	mRoot->addFrameListener(this);

	mRoot->startRendering();

	return true;
}
예제 #23
0
void Application::initialise()
{
	//m_root = new Ogre::Root( "ogre_plugins.txt", "ogre_configuration.txt", "ogre_log.txt" );
	m_root = new Ogre::Root();

	Ogre::ConfigFile cf;
    cf.load("resources.cfg");

	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();

	std::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 display options.
	// It shows the ugly dialog at start-up, so if you don't want to see it, it's up to you 
	// to remove this line and initialise display options manually ( e.g. reading them from 
	// a text file ).
	bool configDialogUserContinue = m_root->showConfigDialog();
	if ( ! configDialogUserContinue )
	{
		throw std::exception( "User closed/canceled config dialog" );
	}

	// Create window with chosen display options.
	m_window = m_root->initialise( true, "Ogre Window" );

	m_sceneManager = m_root->createSceneManager( Ogre::ST_GENERIC );

	m_camera = m_sceneManager->createCamera( "DefaultCamera" );

	m_viewport = m_window->addViewport( m_camera );

	m_viewport->setBackgroundColour( Ogre::ColourValue( 0, 0, 0 ) );

	SimpleInputManager::initialise( m_window );

	loadResources();

	createSceneSet1();
	//createSceneSet2();
	//createSceneSet3();

	createCamera();
}
예제 #24
0
void loadMaterialControlsFile(MaterialControlsContainer& controlsContainer, const Ogre::String& filename)
{
    // Load material controls from config file
    Ogre::ConfigFile cf;

    try
    {

        cf.load(filename, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, "\t;=", true);

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

        Ogre::String secName, typeName, materialName, dataString;

        while (seci.hasMoreElements())
        {
            secName = seci.peekNextKey();
            Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
            if (!secName.empty() && settings)
            {
                materialName = cf.getSetting("material", secName);
				
				Ogre::MaterialPtr curMat = Ogre::MaterialManager::getSingleton().getByName(materialName);
				curMat->load();
				Ogre::Technique * curTec = curMat->getBestTechnique();
				if (!curTec || !curTec->isSupported())
				{
					continue;
				}

                MaterialControls newMaaterialControls(secName, materialName);
                controlsContainer.push_back(newMaaterialControls);

                size_t idx = controlsContainer.size() - 1;

                Ogre::ConfigFile::SettingsMultiMap::iterator i;

                for (i = settings->begin(); i != settings->end(); ++i)
                {
                    typeName = i->first;
                    dataString = i->second;
                    if (typeName == "control")
                        controlsContainer[idx].addControl(dataString);
                }
            }
        }

	    Ogre::LogManager::getSingleton().logMessage( "Material Controls setup" );
    }
    catch (Ogre::Exception e)
    {
        // Guess the file didn't exist
    }
}
예제 #25
0
	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;
			}
		}

		OGRE_NEW Ogre::FontManager();
		Ogre::FontPtr font = (Ogre::FontPtr)Ogre::FontManager::getSingletonPtr()->create("bluehigh","General");
		font->setParameter("MovableText","truetype");
		// set the .ttf file name
		font->setParameter("source","bluehigh.ttf");
		// set the size
		font->setParameter("size","18");
		// set the dpi
		font->setParameter("resolution","96");

		Ogre::FontPtr font2 = (Ogre::FontPtr)Ogre::FontManager::getSingletonPtr()->create("TESFont","General");
		font2->setParameter("StaticText","truetype");
		// set the .ttf file name
		font2->setParameter("source","TESFont.ttf");
		// set the size
		font2->setParameter("size","18");
		// set the dpi
		font2->setParameter("resolution","96");

	} // setupResources
예제 #26
0
파일: App3D.cpp 프로젝트: TES3MP/RakNet
void App3D::PostConfigure(const char *defaultResourceConfigurationPath, bool recursive)
{
	// Instantiate the math class to build the trig tables.
	math = new Ogre::Math;

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

	// 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();
		// Seems like General is created automatically going by ogre.log
		if (secName!="General")
		{			
			try
			{
				Ogre::ResourceGroupManager::getSingleton().createResourceGroup(secName);
			}
			catch (Ogre::Exception& e)
			{
				e;
			}
		}
		
		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, recursive);
		}
	}

	// Window should have been created in Configure, or created here in a derived class
	Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap");
	Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("General");

	const Ogre::RenderSystemCapabilities* cap = root->getRenderSystem()->getCapabilities();
	// + (*cap).mMaxFragmentProgramVersion "ps_2_b" std::basic_string<char,std::char_traits<char>,std::allocator<char> >
//	if (cap->getMaxFragmentProgramVersion().c_str()[3]>='2')
		hasPixelShader2=true;
//	else
//		hasPixelShader2=false;
}
예제 #27
0
bool OgreBaseApp::setup(void)
{
	std::ifstream videoFile;
	videoFile.open("screen_size.cfg");
	if (videoFile.good())
	{
		std::string width, height;
		getline(videoFile, width);
		getline(videoFile, height);
		
		mWindowWidth = atoi(width.c_str());
		mWindowHeight = atoi(height.c_str());
	}
	SDL_Init(SDL_INIT_VIDEO);
	SDL_SetVideoMode(mWindowWidth, mWindowHeight, 0, SDL_OPENGL);
	
	//construct the Ogre::Root object
	mRoot = new Ogre::Root(mPluginsCfg);

	//set up resources
	Ogre::ConfigFile cf;
	cf.load(mResourcesCfg);

	//go through all the sections and 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);
		}
	}

	//configure
	//first try to restore the config, if that fails, ask the user, and if they cancel out of that, quit the program
	if ( !(mRoot->restoreConfig() || mRoot->showConfigDialog()) )
	{
		return false;
	}
	
	return true;
}
예제 #28
0
static void setupScene()
{
	LOGI("------->setupScene()");

	Ogre::ConfigFile cf;
	cf.load(openAPKFile("resources.cfg"));

	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
	while (seci.hasMoreElements())
	{
		Ogre::String sec, type, arch;
		sec = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;

		for (i = settings->begin(); i != settings->end(); i++)
		{
			type = i->first;
			arch = i->second;
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(arch, type, sec);
		}
	}

	Ogre::ResourceGroupManager::getSingletonPtr()->initialiseResourceGroup(
			Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

	gSceneMgr = gRoot->createSceneManager(Ogre::ST_GENERIC);
	Ogre::Camera* camera = gSceneMgr->createCamera("MyCam");

	Ogre::Entity* pEntity = gSceneMgr->createEntity("SinbadInstance", "Sinbad.mesh");
	Ogre::SceneNode* pNode = gSceneMgr->getRootSceneNode()->createChildSceneNode();
	pNode->attachObject(pEntity);

	Ogre::Light* pDirLight = gSceneMgr->createLight();
	pDirLight->setDirection(Ogre::Vector3(0, -1, 0));
	pDirLight->setType(Ogre::Light::LT_DIRECTIONAL);
	pNode->attachObject(pDirLight);

	camera->setNearClipDistance(1.0f);
	camera->setFarClipDistance(100000.0f);
	camera->setPosition(0, 0, 20.0f);
	camera->lookAt(0, 0, 0);
	camera->setAutoAspectRatio(true);

	Ogre::Viewport* vp = gRenderWnd->addViewport(camera);
	vp->setBackgroundColour(Ogre::ColourValue(1, 0, 0));

	LOGI("<-------setupScene()");
}
예제 #29
0
bool OgreApplication::initStart(void)
{

    mPluginsCfg = "../configs/plugins.cfg";
    mResourcesCfg = "../configs/resources.cfg";

    Ogre::LogManager * lm = new Ogre::LogManager();
    lm->createLog("OgreLogfile.log", true, false, false);

    // construct Ogre::Root
    mRoot = new Ogre::Root(mPluginsCfg, "", "");

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

    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../assets/", "FileSystem");

    Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../assets/particles", "FileSystem");

    // Do not add this to the application
    Ogre::RenderSystem *rs = mRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
    mRoot->setRenderSystem(rs);
    rs->setConfigOption("Full Screen", "No");
    rs->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
    rs->setStencilCheckEnabled(true);

    mRoot->initialise(false);

    running = true;
    return true;
}
예제 #30
0
파일: Main.cpp 프로젝트: DeejStar/q-gears
void
fill_names()
{
    Unit unit;
    unit.name = "";
    Field field;


    Ogre::ConfigFile cf;
    cf.load( "export.cfg" );
    Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();

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

        if( field.name != "" )
        {

            Ogre::ConfigFile::SettingsMultiMap::iterator i;
            for( i = settings->begin(); i != settings->end(); ++i )
            {
                if( i->second != "" )
                {
                    Ogre::StringVector export_data = Ogre::StringUtil::split( i->second, ":", 1 );

                    unit.name = export_data[ 0 ];

                    Ogre::StringVector animations = Ogre::StringUtil::split( export_data[ 1 ], ",", 0 );
                    //LOGGER->Log(LOGGER_INFO, "Export %s: %s", field.name.c_str(), unit.name.c_str());
                    for( int i = 0; i < animations.size(); ++i )
                    {
                        unit.animations.push_back( animations[ i ] );
                    }
                }

                field.units.push_back(unit);
                unit.name = "";
                unit.animations.clear();
            }

            //LOGGER->Log(LOGGER_INFO, "Add export field %s", field.name.c_str());
            fields.push_back(field);
            field.units.clear();
        }
    }
}