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