MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / registerHlms

Method registerHlms

Samples/2.0/Common/src/GraphicsSystem.cpp:717–811  ·  view source on GitHub ↗

-----------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

715 }
716 //-----------------------------------------------------------------------------------
717 void GraphicsSystem::registerHlms()
718 {
719 Ogre::ConfigFile cf;
720 cf.load( AndroidSystems::openFile( mResourcePath + "resources2.cfg" ) );
721
722#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
723 Ogre::String rootHlmsFolder =
724 Ogre::macBundlePath() + '/' + cf.getSetting( "DoNotUseAsResource", "Hlms", "" );
725#else
726 Ogre::String rootHlmsFolder = mResourcePath + cf.getSetting( "DoNotUseAsResource", "Hlms", "" );
727#endif
728
729 if( rootHlmsFolder.empty() )
730 rootHlmsFolder = AndroidSystems::isAndroid() ? "/" : "./";
731 else if( *( rootHlmsFolder.end() - 1 ) != '/' )
732 rootHlmsFolder += "/";
733
734 // At this point rootHlmsFolder should be a valid path to the Hlms data folder
735
736 Ogre::HlmsUnlit *hlmsUnlit = 0;
737 Ogre::HlmsPbs *hlmsPbs = 0;
738
739 // For retrieval of the paths to the different folders needed
740 Ogre::String mainFolderPath;
741 Ogre::StringVector libraryFoldersPaths;
742 Ogre::StringVector::const_iterator libraryFolderPathIt;
743 Ogre::StringVector::const_iterator libraryFolderPathEn;
744
745 Ogre::ArchiveManager &archiveManager = Ogre::ArchiveManager::getSingleton();
746
747 const Ogre::String &archiveType = getMediaReadArchiveType();
748
749 {
750 // Create & Register HlmsUnlit
751 // Get the path to all the subdirectories used by HlmsUnlit
752 Ogre::HlmsUnlit::getDefaultPaths( mainFolderPath, libraryFoldersPaths );
753 Ogre::Archive *archiveUnlit =
754 archiveManager.load( rootHlmsFolder + mainFolderPath, archiveType, true );
755 Ogre::ArchiveVec archiveUnlitLibraryFolders;
756 libraryFolderPathIt = libraryFoldersPaths.begin();
757 libraryFolderPathEn = libraryFoldersPaths.end();
758 while( libraryFolderPathIt != libraryFolderPathEn )
759 {
760 Ogre::Archive *archiveLibrary =
761 archiveManager.load( rootHlmsFolder + *libraryFolderPathIt, archiveType, true );
762 archiveUnlitLibraryFolders.push_back( archiveLibrary );
763 ++libraryFolderPathIt;
764 }
765
766 // Create and register the unlit Hlms
767 hlmsUnlit = OGRE_NEW Ogre::HlmsUnlit( archiveUnlit, &archiveUnlitLibraryFolders );
768 Ogre::Root::getSingleton().getHlmsManager()->registerHlms( hlmsUnlit );
769 }
770
771 {
772 // Create & Register HlmsPbs
773 // Do the same for HlmsPbs:
774 Ogre::HlmsPbs::getDefaultPaths( mainFolderPath, libraryFoldersPaths );

Callers

nothing calls this directly

Calls 14

openFileFunction · 0.85
HlmsUnlitClass · 0.85
getHlmsManagerMethod · 0.80
HlmsPbsClass · 0.50
loadMethod · 0.45
getSettingMethod · 0.45
emptyMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
push_backMethod · 0.45
getRenderSystemMethod · 0.45

Tested by

no test coverage detected