本文整理汇总了C++中ogre::StringVector::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ StringVector::begin方法的具体用法?C++ StringVector::begin怎么用?C++ StringVector::begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::StringVector
的用法示例。
在下文中一共展示了StringVector::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadFactories
void ObjectManager::loadFactories(const String& factoriesfile)
{
String pluginDir;
Ogre::StringVector pluginList;
Ogre::ConfigFile cfg;
try {
cfg.load( factoriesfile );
}
catch (Ogre::Exception)
{
Ogre::LogManager::getSingleton().logMessage(factoriesfile + " not found, automatic object factories loading disabled.");
return;
}
pluginDir = cfg.getSetting("ObjectFactoryFolder"); // Ignored on Mac OS X, uses Resources/ directory
pluginList = cfg.getMultiSetting("ObjectFactory");
char last_char = pluginDir[pluginDir.length()-1];
if (last_char != '/' && last_char != '\\')
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
pluginDir += "\\";
#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
pluginDir += "/";
#endif
}
for( Ogre::StringVector::iterator it = pluginList.begin(); it != pluginList.end(); ++it )
{
this->loadFactory(pluginDir + (*it));
}
}
示例2: startRandomTitle
void SoundManager::startRandomTitle()
{
Ogre::StringVector filelist;
if (mMusicFiles.find(mCurrentPlaylist) == mMusicFiles.end())
{
Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups ();
for (Ogre::StringVector::iterator it = groups.begin(); it != groups.end(); ++it)
{
Ogre::StringVectorPtr resourcesInThisGroup = mResourceMgr.findResourceNames(*it,
"Music/"+mCurrentPlaylist+"/*");
filelist.insert(filelist.end(), resourcesInThisGroup->begin(), resourcesInThisGroup->end());
}
mMusicFiles[mCurrentPlaylist] = filelist;
}
else
filelist = mMusicFiles[mCurrentPlaylist];
if(!filelist.size())
return;
int i = rand()%filelist.size();
// Don't play the same music track twice in a row
if (filelist[i] == mLastPlayedMusic)
{
i = (i+1) % filelist.size();
}
streamMusicFull(filelist[i]);
}
示例3: destroyResourceGroup
//!
//! Destroy the node's Ogre resource group.
//!
void OgreTools::destroyResourceGroup ( const QString &name )
{
Ogre::StringVector groupNames = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
if (std::find(groupNames.begin(), groupNames.end(), name.toStdString()) != groupNames.end()) {
Ogre::ResourceGroupManager::getSingleton().destroyResourceGroup(name.toStdString());
}
}
示例4: add
//--------------------------------------------------------------------------------
void CMultiSelEditor::add(const Ogre::StringVector& newselection)
{
if(mDeletionInProgress)
return;
Ogre::StringVector::const_iterator it = newselection.begin();
while(it != newselection.end())
{
CBaseEditor *object = mOgitorsRoot->FindObject(*it);
if(object && object != this)
{
if(mSelectedObjects.find(object->getName()) == mSelectedObjects.end())
{
mSelectedObjects.insert(NameObjectPairList::value_type(object->getName(), object));
object->setSelected(true);
}
}
it++;
}
_createModifyList();
}
示例5: remove
//--------------------------------------------------------------------------------
void CMultiSelEditor::remove(const Ogre::StringVector& newselection)
{
if(mDeletionInProgress)
return;
Ogre::StringVector::const_iterator it = newselection.begin();
NameObjectPairList::iterator dit;
while(it != newselection.end())
{
CBaseEditor *object = mOgitorsRoot->FindObject(*it);
if(object)
{
if((dit = mSelectedObjects.find(object->getName())) != mSelectedObjects.end())
{
mSelectedObjects.erase(dit);
object->setSelected(false);
}
}
it++;
}
_createModifyList();
}
示例6: trimDisplayArea
void LogMessageWindow::trimDisplayArea(const char* aMsg)
{
m_displaylog.append(Ogre::UTFString(CharToWchar(aMsg)));
m_displaylog.append("\n");
Ogre::StringVector v = Ogre::StringUtil::split(m_displaylog,"\n");
while(v.size()>m_displaylinenum)
{
v.erase(v.begin());
m_displaylog.clear();
for (Ogre::StringVector::iterator i = v.begin(); i != v.end(); ++i)
{
m_displaylog.append(i->c_str());
m_displaylog.append("\n");
}
v = Ogre::StringUtil::split(m_displaylog,"\n");
}
}
示例7: unloadUnusedResources
void OgreResourceLoader::unloadUnusedResources()
{
TimedLog l("Unload unused resources.");
Ogre::ResourceGroupManager& resourceGroupManager(Ogre::ResourceGroupManager::getSingleton());
Ogre::StringVector resourceGroups = resourceGroupManager.getResourceGroups();
for (Ogre::StringVector::const_iterator I = resourceGroups.begin(); I != resourceGroups.end(); ++I) {
resourceGroupManager.unloadUnreferencedResourcesInGroup(*I, false);
}
}
示例8: loadAllFonts
void FontLoader::loadAllFonts(bool exportToFile)
{
Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups ();
for (Ogre::StringVector::iterator it = groups.begin(); it != groups.end(); ++it)
{
Ogre::StringVectorPtr resourcesInThisGroup = Ogre::ResourceGroupManager::getSingleton ().findResourceNames (*it, "*.fnt");
for (Ogre::StringVector::iterator resource = resourcesInThisGroup->begin(); resource != resourcesInThisGroup->end(); ++resource)
{
loadFont(*resource, exportToFile);
}
}
}
示例9: doInvoke
void MeshMergeTool::doInvoke(const OptionList& toolOptions,
const Ogre::StringVector& inFileNames,
const Ogre::StringVector& outFileNames)
{
if (outFileNames.size() != 1)
{
fail("Exactly one output file must be specified.");
return;
}
else if (inFileNames.size() == 0)
{
fail("No input files specified.");
return;
}
StatefulMeshSerializer* meshSer = OgreEnvironment::getSingleton().getMeshSerializer();
StatefulSkeletonSerializer* skelSer =
OgreEnvironment::getSingleton().getSkeletonSerializer();
for (Ogre::StringVector::const_iterator it = inFileNames.begin();
it != inFileNames.end(); ++it)
{
MeshPtr curMesh = meshSer->loadMesh(*it);
if (!curMesh.isNull())
{
if (curMesh->hasSkeleton() && SkeletonManager::getSingleton().getByName(
curMesh->getSkeletonName()).isNull())
{
skelSer->loadSkeleton(curMesh->getSkeletonName());
}
addMesh(curMesh);
}
else
{
warn("Skipped: Mesh " + *it + " cannnot be loaded.");
}
}
Ogre::String outputfile = *outFileNames.begin();
meshSer->exportMesh(merge(outputfile).getPointer(), outputfile);
}
示例10: mBaseDirectory
CSMWorld::Resources::Resources (const std::string& baseDirectory, UniversalId::Type type,
const char * const *extensions)
: mBaseDirectory (baseDirectory), mType (type)
{
int baseSize = mBaseDirectory.size();
Ogre::StringVector resourcesGroups =
Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
for (Ogre::StringVector::iterator iter (resourcesGroups.begin());
iter!=resourcesGroups.end(); ++iter)
{
if (*iter=="General" || *iter=="Internal" || *iter=="Autodetect")
continue;
Ogre::StringVectorPtr resources =
Ogre::ResourceGroupManager::getSingleton().listResourceNames (*iter);
for (Ogre::StringVector::const_iterator iter (resources->begin());
iter!=resources->end(); ++iter)
{
if (static_cast<int> (iter->size())<baseSize+1 ||
iter->substr (0, baseSize)!=mBaseDirectory ||
((*iter)[baseSize]!='/' && (*iter)[baseSize]!='\\'))
continue;
if (extensions)
{
std::string::size_type index = iter->find_last_of ('.');
if (index==std::string::npos)
continue;
std::string extension = iter->substr (index+1);
int i = 0;
for (; extensions[i]; ++i)
if (extensions[i]==extension)
break;
if (!extensions[i])
continue;
}
std::string file = iter->substr (baseSize+1);
mFiles.push_back (file);
mIndex.insert (std::make_pair (file, static_cast<int> (mFiles.size())-1));
}
}
}
示例11: initializeRTShaderSystem
/*-----------------------------------------------------------------------------
| Initialize the RT Shader system.
-----------------------------------------------------------------------------*/
bool DemoApp::initializeRTShaderSystem(Ogre::SceneManager* sceneMgr)
{
if (Ogre::RTShader::ShaderGenerator::initialize())
{
mShaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
mShaderGenerator->addSceneManager(sceneMgr);
// Setup core libraries and shader cache path.
Ogre::StringVector groupVector = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
Ogre::StringVector::iterator itGroup = groupVector.begin();
Ogre::StringVector::iterator itGroupEnd = groupVector.end();
Ogre::String shaderCoreLibsPath;
Ogre::String shaderCachePath;
for (; itGroup != itGroupEnd; ++itGroup)
{
Ogre::ResourceGroupManager::LocationList resLocationsList = Ogre::ResourceGroupManager::getSingleton().getResourceLocationList(*itGroup);
Ogre::ResourceGroupManager::LocationList::iterator it = resLocationsList.begin();
Ogre::ResourceGroupManager::LocationList::iterator itEnd = resLocationsList.end();
bool coreLibsFound = false;
// Try to find the location of the core shader lib functions and use it
// as shader cache path as well - this will reduce the number of generated files
// when running from different directories.
for (; it != itEnd; ++it)
{
if ((*it)->archive->getName().find("RTShaderLib") != Ogre::String::npos)
{
shaderCoreLibsPath = (*it)->archive->getName() + "/";
shaderCachePath = shaderCoreLibsPath;
coreLibsFound = true;
break;
}
}
// Core libs path found in the current group.
if (coreLibsFound)
break;
}
// Core shader libs not found -> shader generating will fail.
if (shaderCoreLibsPath.empty())
return false;
// Create and register the material manager listener.
mMaterialMgrListener = new ShaderGeneratorTechniqueResolverListener(mShaderGenerator);
Ogre::MaterialManager::getSingleton().addListener(mMaterialMgrListener);
}
return true;
}
示例12: LoadOgrePlugins
bool OgreSubsystem::LoadOgrePlugins(Ogre::String const & pluginsfile)
{
Ogre::StringVector pluginList;
Ogre::String pluginDir;
Ogre::ConfigFile cfg;
try
{
cfg.load( pluginsfile );
}
catch (Ogre::Exception)
{
Ogre::LogManager::getSingleton().logMessage(pluginsfile + " not found, automatic plugin loading disabled.");
return false;
}
pluginDir = cfg.getSetting("PluginFolder"); // Ignored on Mac OS X, uses Resources/ directory
pluginList = cfg.getMultiSetting("Plugin");
#if OGRE_PLATFORM != OGRE_PLATFORM_APPLE && OGRE_PLATFORM != OGRE_PLATFORM_IPHONE
if (pluginDir.empty())
{
// User didn't specify plugins folder, try current one
pluginDir = ".";
}
#endif
char last_char = pluginDir[pluginDir.length()-1];
if (last_char != '/' && last_char != '\\')
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
pluginDir += "\\";
#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
pluginDir += "/";
#endif
}
for ( Ogre::StringVector::iterator it = pluginList.begin(); it != pluginList.end(); ++it )
{
Ogre::String pluginFilename = pluginDir + (*it);
try
{
m_ogre_root->loadPlugin(pluginFilename);
}
catch(Ogre::Exception &e)
{
LOG("failed to load plugin: " + pluginFilename + ": " + e.getFullDescription());
}
}
return true;
}
示例13: resourceGroupExist
bool ResourceGroupReloader::resourceGroupExist(const std::string& pResourceGroupName)
{
bool lIsPresent = false;
Ogre::ResourceGroupManager& resGroupMgr = Ogre::ResourceGroupManager::getSingleton();
Ogre::StringVector lAllResourceGroups = resGroupMgr.getResourceGroups();
Ogre::StringVector::iterator iter = lAllResourceGroups.begin();
Ogre::StringVector::iterator iterEnd = lAllResourceGroups.end();
for(;iter!=iterEnd;iter++)
{
if((*iter) == pResourceGroupName)
{
lIsPresent = true;
}
}
return lIsPresent;
}
示例14: startRandomTitle
void SoundManager::startRandomTitle()
{
Ogre::StringVector filelist;
Ogre::StringVector groups = Ogre::ResourceGroupManager::getSingleton().getResourceGroups ();
for (Ogre::StringVector::iterator it = groups.begin(); it != groups.end(); ++it)
{
Ogre::StringVectorPtr resourcesInThisGroup = mResourceMgr.findResourceNames(*it,
"Music/"+mCurrentPlaylist+"/*");
filelist.insert(filelist.end(), resourcesInThisGroup->begin(), resourcesInThisGroup->end());
}
if(!filelist.size())
return;
int i = rand()%filelist.size();
streamMusicFull(filelist[i]);
}
示例15:
void OgreSample8App::loadResources()
{
BaseApp::loadResources();
#ifdef USE_RTSHADER_SYSTEM
ResourceGroupManager& rgm = ResourceGroupManager::getSingleton();
Ogre::StringVector groupVector = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
Ogre::StringVector::iterator itGroup = groupVector.begin();
Ogre::StringVector::iterator itGroupEnd = groupVector.end();
Ogre::String shaderCoreLibsPath;
for (; itGroup != itGroupEnd ; ++itGroup)
{
Ogre::ResourceGroupManager::LocationList resLocationList = Ogre::ResourceGroupManager::getSingleton().getResourceLocationList(*itGroup);
Ogre::ResourceGroupManager::LocationList::iterator it = resLocationList.begin();
Ogre::ResourceGroupManager::LocationList::iterator itEnd = resLocationList.end();
bool coreLibsFound = false;
for (; it != itEnd; it++)
{
if ((*it)->archive->getName().find("RTShaderLib") != Ogre::String::npos)
{
shaderCoreLibsPath = (*it)->archive->getName() + "/";
coreLibsFound = true;
break;
}
}
if (coreLibsFound)
{
break;
}
rgm.createResourceGroup("RTShaderSystemMaterialsGroup");
rgm.addResourceLocation(shaderCoreLibsPath + "materials","FileSystem","RTShaderSystemMaterialGroup");
rgm.initialiseResourceGroup("RTShaderSystemMaterialsGroup");
rgm.loadResourceGroup("RTShaderSystemMaterialsGroup",true);
}
#endif
}