本文整理汇总了C++中ogre::FileInfoListPtr::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ FileInfoListPtr::begin方法的具体用法?C++ FileInfoListPtr::begin怎么用?C++ FileInfoListPtr::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::FileInfoListPtr
的用法示例。
在下文中一共展示了FileInfoListPtr::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
const VectorString& OgreDataManager::getDataListNames(const std::string& _pattern, bool _fullpath)
{
static VectorString result;
result.clear();
Ogre::FileInfoListPtr pFileInfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(mGroup, _pattern);
result.reserve(pFileInfo->size());
for (Ogre::FileInfoList::iterator fi = pFileInfo->begin(); fi != pFileInfo->end(); ++fi )
{
if (fi->path.empty())
{
bool found = false;
for (VectorString::iterator iter = result.begin(); iter != result.end(); ++iter)
{
if (*iter == fi->filename)
{
found = true;
break;
}
}
if (!found)
{
result.push_back(_fullpath ? fi->archive->getName() + "/" + fi->filename : fi->filename);
}
}
}
pFileInfo.setNull();
return result;
}
示例2: Assert
KVOID Kylin::Scene::SpawnScene()
{
Assert(KylinRoot::GetSingletonPtr()->GetGameFramePtr());
m_pSceneLoader = KylinRoot::GetSingletonPtr()->GetGameFramePtr()->CreateSceneLoader();
//-----------------------------------------------------------------
// ╪стьЁ║╬╟
Ogre::FileInfoListPtr resPtr = Ogre::ResourceGroupManager::getSingletonPtr()->findResourceFileInfo("General", m_kSceneHag.m_sSceneFile);
Ogre::FileInfo fInfo = (*(resPtr->begin()));
KSTR sName = fInfo.archive->getName();
sName += "/" + m_kSceneHag.m_sSceneFile;
//------------------------------------------------------------------
// ╪сть╠Ё╬╟рТюж
KylinRoot::GetSingletonPtr()->CreateSound("$BackgroundSound",m_kSceneHag.m_nBgSound);
//------------------------------------------------------------------
// ж╢ппluaнд╪Ч
KSTR sLua = StringUtils::replace(sName,".xml",".lua");
OgreRoot::GetSingletonPtr()->GetScriptVM()->ExecuteScriptFile(sLua.data());
//-----------------------------------------------------------------
// ╪стьlevel
m_pSceneLoader->LoadLevel(m_kSceneHag.m_sSceneFile);
//-----------------------------------------------------------------
// ╪стьЁ║╬╟ё╛NPC╣х
if (!m_pSceneLoader->LoadScene(m_kSceneHag.m_sSceneFile))
{
AssertEx(NULL,"Ё║╬╟╪стьй╖╟эё║");
return;
}
//-----------------------------------------------------------------
// ╪стьмФ╪р
m_pSceneLoader->LoadPlayer();
}
示例3:
void
SoundTrack::loadImpl()
{
Log *errorLog = OGF::LogFactory::getSingletonPtr()->get(OGF::LOG_ERR);
Ogre::FileInfoListPtr resourceInfo = Ogre::ResourceGroupManager::getSingletonPtr()->findResourceFileInfo(mGroup, mName);
for(Ogre::FileInfoList::iterator it = resourceInfo->begin(); it != resourceInfo->end(); it++)
_path = it->archive->getName() + "/" + it->filename;
if (_path == "") {
std::string errorMessage = "Impossible to find sound resource: " + mName;
errorLog->log("SoundTrack", "loadImpl", errorMessage, OGF::LOG_SEVERITY_ERROR);
throw errorMessage;
}
if ((_playableSource = Mix_LoadMUS(_path.c_str())) == NULL) {
std::string errorMessage = "Impossible to load sound resource: " + _path;
errorLog->log("SoundTrack", "loadImpl", errorMessage, OGF::LOG_SEVERITY_ERROR);
throw errorMessage;
}
// Calculate size
std::ifstream stream;
stream.open(_path.c_str(), std::ios_base::binary);
char temp;
while (stream >> temp)
_size++;
stream.close();
}
示例4: loadImpl
void SoundFX::loadImpl() {
Ogre::LogManager* pLogManager = Ogre::LogManager::getSingletonPtr();
// Ruta al archivo.
Ogre::FileInfoListPtr info;
info = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(mGroup, mName);
for (Ogre::FileInfoList::iterator i = info->begin(); i != info->end(); ++i) {
_path = i->archive->getName() + "/" + i->filename;
}
// Archivo no encontrado...
if (_path == "") {
pLogManager->logMessage("SoundFX::loadImpl() Imposible encontrar el recurso.");
throw (Ogre::Exception(Ogre::Exception::ERR_FILE_NOT_FOUND,
"Imposible encontrar el recurso", "SoundFX::loadImpl()"));
}
// Cargar el efecto de sonido.
if ((_pSound = Mix_LoadWAV(_path.c_str())) == NULL) {
pLogManager->logMessage("SoundFX::loadImpl() Imposible cargar el efecto.");
throw (Ogre::Exception(Ogre::Exception::ERR_INTERNAL_ERROR,
"Imposible cargar el efecto", "SoundFX::loadImpl()"));
}
// Cálculo del tamaño del recurso de sonido.
std::ifstream stream;
char byteBuffer;
stream.open(_path.c_str(), std::ios_base::binary);
while (stream >> byteBuffer) {
++_size;
}
stream.close();
}
示例5:
const VectorString& Ogre2DataManager::getDataListNames(const std::string& _pattern, bool _fullpath)
{
static VectorString result;
result.clear();
VectorString search;
if (mAllGroups)
{
Ogre::StringVector sp = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
search.reserve(sp.size());
for (size_t i = 0; i < sp.size(); i++)
search.push_back(sp[i]);
}
else
search.push_back(mGroup);
std::vector<Ogre::FileInfoListPtr> pFileInfos;
int resultSize = 0;
for (size_t i = 0; i < search.size(); i++)
{
Ogre::FileInfoListPtr pFileInfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(search[i], _pattern);
resultSize += pFileInfo->size();
if (!pFileInfo->empty())
pFileInfos.push_back(pFileInfo);
else
pFileInfo.setNull();
}
result.reserve(resultSize);
for (size_t i = 0; i < pFileInfos.size(); i++)
{
Ogre::FileInfoListPtr pFileInfo = pFileInfos[i];
for (Ogre::FileInfoList::iterator fi = pFileInfo->begin(); fi != pFileInfo->end(); ++fi )
{
if (fi->path.empty())
{
bool found = false;
for (VectorString::iterator iter = result.begin(); iter != result.end(); ++iter)
{
if (*iter == fi->filename)
{
found = true;
break;
}
}
if (!found)
{
result.push_back(_fullpath ? fi->archive->getName() + "/" + fi->filename : fi->filename);
}
}
}
pFileInfo.setNull();
}
return result;
}
示例6: addEditorResources
//-----------------------------------------------------------------------------------------
void CTerrainGroupEditorFactory::addEditorResources(bool changeDefaultNames)
{
OgitorsRoot* ogitorsRoot = OgitorsRoot::getSingletonPtr();
Ogre::String terrainDir = ogitorsRoot->GetProjectOptions()->TerrainDirectory;
// create Terrain project folder and folder to hold the terrain
ogitorsRoot->GetProjectFile()->createDirectory(terrainDir.c_str());
ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/terrain/").c_str());
// copy default plant textures
ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/plants/").c_str());
Ogre::String copydir = Ogitors::Globals::MEDIA_PATH + "/plants/";
OgitorsUtils::CopyDirOfs(copydir, (terrainDir+"/plants/").c_str());
// copy default terrain textures sorting them into two different folders
ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/textures/").c_str());
ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/textures/diffusespecular").c_str());
ogitorsRoot->GetProjectFile()->createDirectory((terrainDir+"/textures/normalheight").c_str());
Ogre::ResourceGroupManager *mngr = Ogre::ResourceGroupManager::getSingletonPtr();
copydir = Ogitors::Globals::MEDIA_PATH + "/terrainTextures/";
mngr->addResourceLocation(copydir,"FileSystem","CopyTerrain");
Ogre::FileInfoListPtr resList = mngr->listResourceFileInfo("CopyTerrain");
// copy the files to the different directories
OFS::OfsPtr& file = ogitorsRoot->GetProjectFile();
for (Ogre::FileInfoList::const_iterator it = resList->begin(); it != resList->end(); ++it)
{
Ogre::FileInfo fInfo = (*it);
Ogre::String loc = copydir + fInfo.path + fInfo.filename;
Ogre::String newName = fInfo.filename;
if(fInfo.archive->getType() == "FileSystem")
{
if(fInfo.filename.find("diffusespecular") != -1)
{
/* since we're using different resource groups for the terrain lets
remove the naming scheme from the filenames except if the project
is being upgraded, in which case leave the name alone. */
if (changeDefaultNames) {
newName = Ogre::StringUtil::replaceAll(newName, "_diffusespecular", "");
}
OgitorsUtils::CopyFileOfs(loc, terrainDir+"/textures/diffusespecular/"+newName);
}
if(fInfo.filename.find("normalheight") != -1)
{
if (changeDefaultNames) {
newName = Ogre::StringUtil::replaceAll(newName, "_normalheight", "");
}
OgitorsUtils::CopyFileOfs(loc, terrainDir+"/textures/normalheight/"+newName);
}
}
}
resList.setNull();
ogitorsRoot->DestroyResourceGroup("CopyTerrain");
}
示例7: wxEnumProperty
void
ObjectPropertyEditor::onSelectObject(const Fairy::ObjectPtr& object)
{
mPropertiesViewer->GetGrid()->Clear();
mCurrentObject = object;
if (mObjNameList.GetCount()<=0)
{
Ogre::FileInfoListPtr fileInfoList =
Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
"*.obj");
for(Ogre::FileInfoList::const_iterator it = fileInfoList->begin(); it != fileInfoList->end(); ++it)
{
const Ogre::String name = it->filename;
mObjNameList.AddString(name.c_str());
}
}
const Fairy::PropertyList& properties = object->getProperties();
for (Fairy::PropertyList::const_iterator it = properties.begin(); it != properties.end(); ++it)
{
const Fairy::PropertyDef& propertyDef = *it;
Fairy::uint propertyFlags = object->getPropertyFlags(propertyDef.name);
wxPGId id;
if (propertyDef.name == "actor name")
{
wxPGProperty* property = NULL;
wxString name = propertyDef.name.c_str();
property = wxEnumProperty(name, name, mObjNameList);
property->SetValueFromString(propertyDef.defaultValue.c_str(),0);
id = AddPropertyRecursive(property);
}
else
{
id = AddPropertyRecursive(mPropertyManager->CreateProperty(propertyDef));
}
wxPGIdToPtr(id)->SetValueFromString(AS_STRING(object->getPropertyAsString(propertyDef.name)), wxPG_FULL_VALUE);
if (propertyFlags & Fairy::PF_READONLY)
{
mPropertiesViewer->DisableProperty(id);
}
}
mPropertiesViewer->Refresh();
}
示例8: move
std::vector<std::wstring> ManipulatorEffect::GetAttachEffectMeshNames()
{
std::vector<std::wstring> ret;
Ogre::FileInfoListPtr fileinfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(
"Effect", "*.mesh");
for(auto iter=fileinfo->begin(); iter!=fileinfo->end(); ++iter)
{
const Ogre::FileInfo& info = *iter;
ret.push_back(Utility::EngineToUnicode(info.basename));
}
return std::move(ret);
}
示例9: setFirstTextureGeneration
//.........这里部分代码省略.........
Ogre::String textureFileNameGeneration = getTextureFileNameGeneration (sequence); // returns full qualified filename
if (sequence == 0)
loadTextureGeneration(textureFileNameGeneration); // Don't check the filename if sequence is 0, because it is without path
else if (textureFileExists(textureFileNameGeneration))
loadTextureGeneration(textureFileNameGeneration);
}
//****************************************************************************/
void TextureLayer::loadTextureGeneration (const Ogre::String& filename)
{
// Assume the filename exists
mTextureOnWhichIsPainted.load(filename, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
mPixelboxTextureOnWhichIsPainted = mTextureOnWhichIsPainted.getPixelBox(0, 0);
mTextureOnWhichIsPaintedHasAlpha = mTextureOnWhichIsPainted.getHasAlpha();
mTextureOnWhichIsPaintedWidth = mPixelboxTextureOnWhichIsPainted.getWidth();
mTextureOnWhichIsPaintedHeight = mPixelboxTextureOnWhichIsPainted.getHeight();
// In theory, createCarbonCopyTexture() of all related paintlayers should be called,
// but the texture size doesn't change in practice.
blitTexture();
}
//****************************************************************************/
void TextureLayer::saveTextureGeneration (void)
{
// Increase the sequence
++mMaxSequence;
Ogre::String textureFileNameGeneration = getTextureFileNameGeneration (mMaxSequence); // returns full qualified filename
// Saving the Image must be done in the background, otherwise the painting stutters
QThread* thread = new QThread;
TextureSaveWorker* textureSaveWorker = new TextureSaveWorker (mTextureOnWhichIsPainted, textureFileNameGeneration);
textureSaveWorker->moveToThread(thread);
connect(thread, SIGNAL(started()), textureSaveWorker, SLOT(saveImage()));
connect(textureSaveWorker, SIGNAL(finished()), thread, SLOT(quit()));
connect(textureSaveWorker, SIGNAL(finished()), textureSaveWorker, SLOT(deleteLater()));
connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater()));
thread->start();
}
//****************************************************************************/
const Ogre::String& TextureLayer::saveTextureWithTimeStampToImportDir (void)
{
Ogre::String strippedTextureFileName = mTextureFileName;
Ogre::String extension = mTextureFileName;
strippedTextureFileName.erase(strippedTextureFileName.find_last_of("."), Ogre::String::npos); // Remove extension
if (strippedTextureFileName.find("_hlms") != Ogre::String::npos)
strippedTextureFileName.erase(strippedTextureFileName.find("_hlms"), Ogre::String::npos); // Remove earlier hlms editor additions
extension.erase(0, extension.find_last_of("."));
mHelperString = strippedTextureFileName +
"_hlms" +
Ogre::StringConverter::toString((size_t)time(0)) +
extension;
mTextureOnWhichIsPainted.save(DEFAULT_IMPORT_PATH.toStdString() + mHelperString); // Saving to the import dir doesn't have to be in the background
return mHelperString; // Return the basename
}
//****************************************************************************/
const Ogre::String& TextureLayer::getTextureFileNameGeneration (int sequence, bool fullQualified)
{
mHelperString = mTextureFileName;
// Do not go beyond the max sequence number
sequence = sequence > mMaxSequence ? mMaxSequence : sequence;
if (sequence > 0)
{
// Do not go below sequence number 1 (otherwise the original mTextureFileName (without path) is returned)
Ogre::String strippedTextureFileName = mTextureFileName;
Ogre::String extension = mTextureFileName;
strippedTextureFileName.erase(strippedTextureFileName.find_last_of("."), Ogre::String::npos);
extension.erase(0, extension.find_last_of("."));
mHelperString = strippedTextureFileName +
Ogre::StringConverter::toString(sequence) +
extension;
if (fullQualified)
mHelperString = TEMP_PATH + mHelperString;
}
return mHelperString;
}
//****************************************************************************/
bool TextureLayer::isTextureFileNameDefinedAsResource (const Ogre::String& filename)
{
Ogre::String path;
Ogre::FileInfoListPtr list = Ogre::ResourceGroupManager::getSingleton().listResourceFileInfo(Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) ;
Ogre::FileInfoList::iterator it;
Ogre::FileInfoList::iterator itStart = list->begin();
Ogre::FileInfoList::iterator itEnd = list->end();
for(it = itStart; it != itEnd; ++it)
{
Ogre::FileInfo& fileInfo = (*it);
if (fileInfo.basename == filename || fileInfo.filename == filename)
return true;
}
return false;
}
示例10: wxT
void
ReshapeDialog::ReloadTextureList(void)
{
if (!Ogre::ResourceGroupManager::getSingletonPtr())
return;
Ogre::Codec::CodecIterator it = Ogre::Codec::getCodecIterator();
while (it.hasMoreElements())
{
const Ogre::String& ext = it.peekNextKey();
Ogre::Codec* codec = it.getNext();
if (codec->getDataType() != "ImageData")
continue;
Ogre::FileInfoListPtr fileInfoList =
Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(
AS_STRING(mResourceGroup),
"*." + ext);
for (Ogre::FileInfoList::const_iterator it = fileInfoList->begin(); it != fileInfoList->end(); ++it)
{
Ogre::String path, baseName;
Ogre::StringUtil::splitFilename(it->filename, baseName, path);
// 把相对路径的最后一个/去掉
if (!path.empty() && path[path.length()-1] == '/')
path.erase(path.length() - 1);
Ogre::String value;
if(path.empty())
{
value = baseName;
}
else
{
value = path + "/" + baseName;
}
mCmbTexture->AppendString( wxT(baseName) );
pathNameMap.insert(make_pair(baseName,value));
}
}
}
示例11:
const Ogre::StringVector& ManipulatorTerrain::GetAllLayerTexThumbnailNames()
{
m_vecLayerTex.clear();
Ogre::FileInfoListPtr fileinfo = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(
"TerrainTextures", "*.png");
int i = 0;
m_vecLayerTex.resize(fileinfo->size());
for (auto iter=fileinfo->begin(); iter!=fileinfo->end(); ++iter)
{
const Ogre::FileInfo& info = (*iter);
m_vecLayerTex[i++] = info.archive->getName() + "/" + info.filename;
}
return m_vecLayerTex;
}
示例12: resolveFilePathForMesh
std::string AssetsManager::resolveFilePathForMesh(Ogre::MeshPtr meshPtr)
{
Ogre::ResourceGroupManager& manager = Ogre::ResourceGroupManager::getSingleton();
const std::multimap<std::string, std::string>& locations = EmberOgre::getSingleton().getResourceLocations();
for (std::multimap<std::string, std::string>::const_iterator I = locations.begin(); I != locations.end(); ++I) {
std::string group = I->first;
std::string fileName = meshPtr->getName();
Ogre::FileInfoListPtr files = manager.findResourceFileInfo(group, fileName, false);
for (Ogre::FileInfoList::const_iterator J = files->begin(); J != files->end(); ++J) {
if (J->filename == fileName) {
return I->second + J->filename;
}
}
}
return "";
}
示例13: openFile
void SoundBank::openFile(std::string path, std::string id, int index)
{
std::string foundPath = path;
Ogre::ResourceGroupManager* groupManager = Ogre::ResourceGroupManager::getSingletonPtr() ;
Ogre::String group = groupManager->findGroupContainingResource(path) ;
Ogre::FileInfoListPtr fileInfos = groupManager->findResourceFileInfo(group,foundPath);
Ogre::FileInfoList::iterator it = fileInfos->begin();
if(it != fileInfos->end())
{
foundPath = it->archive->getName() + "/" + foundPath;
}
else
{
foundPath = "";
}
this->addSound(new SoundChunk(foundPath), id, index);
}
示例14: findFilePath
std::string findFilePath(const std::string& filename)
{
// on demand init
Model::initRessources() ;
std::string foundPath = filename;
Ogre::ResourceGroupManager* groupManager = Ogre::ResourceGroupManager::getSingletonPtr() ;
Ogre::String group = groupManager->findGroupContainingResource(filename) ;
Ogre::FileInfoListPtr fileInfos = groupManager->findResourceFileInfo(group,foundPath);
Ogre::FileInfoList::iterator it = fileInfos->begin();
if(it != fileInfos->end())
{
foundPath = it->archive->getName() + "/" + foundPath;
foundPath;
}
else
foundPath = "";
return foundPath;
}
示例15: kXml
KBOOL Kylin::PathwayLoader::Load( KCCHAR* pScene )
{
Ogre::FileInfoListPtr resPtr = Ogre::ResourceGroupManager::getSingletonPtr()->findResourceFileInfo("General", pScene);
Ogre::FileInfo fInfo = (*(resPtr->begin()));
KSTR sName = StringUtils::replace(pScene,".xml","_pathway.xml");
KSTR sPath = fInfo.archive->getName();
sPath += "/" + sName;
XmlStream kXml(sPath.data());
if (!kXml.Open(XmlStream::Read))
return false;
KBOOL bScene = kXml.SetToFirstChild("pathway");
while (bScene)
{
Pathway* pPathway = KNEW Pathway;
KUINT id = kXml.GetAttrInt("id");
KBOOL bTurnback = kXml.GetAttrBool("turnback");
KBOOL bPoint = kXml.SetToFirstChild("point");
while (bPoint)
{
KFLOAT fX = kXml.GetAttrFloat("x");
KFLOAT fZ = kXml.GetAttrFloat("z");
pPathway->Add(KPoint3(fX,0,fZ));
bPoint = kXml.SetToNextChild("point");
}
m_kPathwayMap.insert(std::pair<KUINT,Pathway*>(id,pPathway));
bScene = kXml.SetToNextChild("pathway");
}
kXml.Close();
return true;
}