MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / setupOgreResources

Method setupOgreResources

source/utils/ResourceManager.cpp:456–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454}
455
456void ResourceManager::setupOgreResources(uint16_t shaderLanguageVersion)
457{
458 Ogre::ConfigFile cf;
459 cf.load(mGameDataPath + RESOURCECFG);
460
461 // Go through all sections & settings in the file
462 Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
463
464 Ogre::String secName = "";
465 Ogre::String typeName = "";
466 Ogre::String archName = "";
467 while(seci.hasMoreElements())
468 {
469 secName = seci.peekNextKey();
470 Ogre::ConfigFile::SettingsMultiMap* settings = seci.getNext();
471 Ogre::ConfigFile::SettingsMultiMap::iterator i;
472 for (i = settings->begin(); i != settings->end(); ++i)
473 {
474 typeName = i->first;
475 archName = mGameDataPath + i->second;
476#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
477 // OS X does not set the working directory relative to the app,
478 // In order to make things portable on OS X we need to provide
479 // the loading with it's own bundle path location.
480 // Unlike windows you can not rely on the curent working directory
481 // for locating your configuration files and resources.
482
483 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
484 Ogre::String(std::string(mMacBundlePath) + archName), typeName, secName, true);
485#else
486 Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
487 archName, typeName, secName, true);
488#endif
489 }
490 }
491
492 // Adds the correct GLSL shader path depending on the GPU capacity
493 Ogre::GpuProgramManager& gpuProgramManager = Ogre::GpuProgramManager::getSingleton();
494 Ogre::ResourceGroupManager& resourceGroupManager = Ogre::ResourceGroupManager::getSingleton();
495 if(gpuProgramManager.isSyntaxSupported("glsl"))
496 {
497 OD_LOG_INF("Supported shader version is: " + Helper::toString(shaderLanguageVersion));
498
499 // Add GLSL shader location for RTShader system
500 resourceGroupManager.addResourceLocation(mGameDataPath + "materials/RTShaderLib/GLSL", "FileSystem", "Graphics");
501
502 // Use patched version of shader on shader version 130+ systems
503 if(shaderLanguageVersion >= 130)
504 {
505 resourceGroupManager.addResourceLocation(mGameDataPath + "materials/RTShaderLib/GLSL/130", "FileSystem", "Graphics");
506 }
507 else
508 {
509 resourceGroupManager.addResourceLocation(mGameDataPath + "materials/RTShaderLib/GLSL/120", "FileSystem", "Graphics");
510 }
511 }
512
513 if (gpuProgramManager.isSyntaxSupported("hlsl"))

Callers 1

startClientMethod · 0.80

Calls 3

StringClass · 0.85
toStringFunction · 0.70
loadMethod · 0.45

Tested by

no test coverage detected