本文整理汇总了C++中ogre::FileInfoListPtr类的典型用法代码示例。如果您正苦于以下问题:C++ FileInfoListPtr类的具体用法?C++ FileInfoListPtr怎么用?C++ FileInfoListPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileInfoListPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mSpeed
//---------------------------------------------------------------------------------------------------------
Vehicle::Vehicle(const std::string &fileName,Ogre::SceneManager* sm,
Ogre::RenderWindow* win, NxScene* ns,
const Ogre::Vector3 pos, const Ogre::Quaternion ori):
mSpeed(0), mAngle(0),mAngleDelta(0),mTurnLeft(0),mTurnRight(0),mRollAngle(0)
{
//初始化各种变量
mSceneMgr = sm;
mWindow = win;
mOriginalPos = pos;
mOriginalQuat = ori;
mNxScene = ns;
//mVehicleInfo.loadFromFile("carinfo.cfg");
mDecalShadow = NULL;
VehicleWheel vw;
mWheels.push_back(vw);
mWheels.push_back(vw);
mWheels.push_back(vw);
mWheels.push_back(vw);
loadScene(fileName);
//load parameter data from file
Ogre::FileInfoListPtr fp =
Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("Popular", fileName + ".vpf");
Ogre::String total = fp->back().archive->getName() + "\\" + fileName + ".vpf";
mVehicleParam.loadFromFile(total);
refreshParameter();
mCarNode = mBaseCarNode;
//创建摄像机节点
mCameraDerivedNode = mCarNode->createChildSceneNode(Ogre::Vector3(0.0f, mBoundingBox.getSize().y, -mBoundingBox.getSize().z*2));
mVehicleCamer = new VehicleCamera(fileName + "VehicleCamera", mWindow, mSceneMgr);
mVehicleCamer->setTarget(mCameraDerivedNode, mCarNode);
mVehicleCamer->setTightness(2.5f);
//获取VehicleCamera计算后得到的CameraNode
mCameraNode = mVehicleCamer->getCameraNode();
//创建车的附加物体外设
createPeriphery();
CompositorManager::getSingleton().addCompositor(mWindow->getViewport(0), "Radial Blur");
CompositorManager::getSingleton().setCompositorEnabled(mWindow->getViewport(0), "Radial Blur", false);
tforce = ttortue = NxVec3(0, 0, 0);
isJet = false;
}
示例2: setOperation
OgreNetworkReply::OgreNetworkReply(const QNetworkRequest &request)
{
setOperation(QNetworkAccessManager::GetOperation);
setRequest(request);
setUrl(request.url());
QString path = request.url().toString(QUrl::RemoveScheme);
// Remote slashes at the beginning
while (path.startsWith('/'))
path = path.mid(1);
qDebug() << "Opening" << path << "from ogre resource.";
Ogre::ResourceGroupManager &resourceManager = Ogre::ResourceGroupManager::getSingleton();
qRegisterMetaType<QNetworkReply::NetworkError>("QNetworkReply::NetworkError");
/* Is it a directory? */
Ogre::FileInfoListPtr fileInfo = resourceManager.findResourceFileInfo("General", path.toStdString(), true);
if (fileInfo->size() > 0) {
QString msg = QString("Cannot open %1: Path is a directory").arg(path);
setError(ContentOperationNotPermittedError, msg);
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentOperationNotPermittedError));
QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
return;
}
try {
mDataStream = resourceManager.openResource(path.toStdString());
} catch (Ogre::FileNotFoundException &e) {
qWarning("Couldn't find %s: %s", qPrintable(path), e.getFullDescription().c_str());
setError(ContentNotFoundError, "Couldn't find " + path);
QMetaObject::invokeMethod(this, "error", Qt::QueuedConnection,
Q_ARG(QNetworkReply::NetworkError, QNetworkReply::ContentNotFoundError));
QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
return;
}
open(QIODevice::ReadOnly);
setHeader(QNetworkRequest::ContentLengthHeader, mDataStream->size());
QMetaObject::invokeMethod(this, "metaDataChanged", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "downloadProgress", Qt::QueuedConnection,
Q_ARG(qint64, mDataStream->size()), Q_ARG(qint64, mDataStream->size()));
QMetaObject::invokeMethod(this, "readyRead", Qt::QueuedConnection);
QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection);
}
示例3:
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;
}
示例4: 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();
}
示例5: 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);
}
示例6: 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;
}
示例7: 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));
}
}
}
示例8:
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;
}
示例9: 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 "";
}
示例10: 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);
}
示例11: 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;
}
示例12: 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;
}
示例13: InitMaterialCombo
void MaterialEditorDialog::InitMaterialCombo(void)
{
typedef std::list<Ogre::String> MaterialFileNameList;
MaterialFileNameList materialFileNameList;
Ogre::FileInfoListPtr fileInfoList =
Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
"*.material");
for (Ogre::FileInfoList::const_iterator it = fileInfoList->begin(); it != fileInfoList->end(); ++it)
{
if ( it->archive->getName() == EFFECT_PATH)
{
materialFileNameList.push_back(it->filename);
}
}
Ogre::ResourceManager::ResourceMapIterator resourceMapIterator = Ogre::MaterialManager::getSingleton().getResourceIterator();
while ( resourceMapIterator.hasMoreElements() )
{
Ogre::String matName = resourceMapIterator.peekNextValue()->getName();
for ( MaterialFileNameList::iterator i = materialFileNameList.begin();
i != materialFileNameList.end(); ++i )
{
if ( *i == resourceMapIterator.peekNextValue()->getOrigin() )
{
mMaterialComboBox->Append(matName);
break;
}
}
resourceMapIterator.moveNext();
}
}
示例14: open
//-----------------------------------------------------------------------
DataStreamPtr ZipArchive::open(const String& filename, bool readOnly)
{
// zziplib is not threadsafe
OGRE_LOCK_AUTO_MUTEX;
String lookUpFileName = filename;
// Format not used here (always binary)
ZZIP_FILE* zzipFile =
zzip_file_open(mZzipDir, lookUpFileName.c_str(), ZZIP_ONLYZIP | ZZIP_CASELESS);
if (!zzipFile) // Try if we find the file
{
const Ogre::FileInfoListPtr fileNfo = findFileInfo(lookUpFileName, true);
if (fileNfo->size() == 1) // If there are more files with the same do not open anyone
{
Ogre::FileInfo info = fileNfo->at(0);
lookUpFileName = info.path + info.basename;
zzipFile = zzip_file_open(mZzipDir, lookUpFileName.c_str(), ZZIP_ONLYZIP | ZZIP_CASELESS); // When an error happens here we will catch it below
}
}
if (!zzipFile)
{
int zerr = zzip_error(mZzipDir);
String zzDesc = getZzipErrorDescription((zzip_error_t)zerr);
LogManager::getSingleton().logMessage(
mName + " - Unable to open file " + lookUpFileName + ", error was '" + zzDesc + "'", LML_CRITICAL);
// return null pointer
return DataStreamPtr();
}
// Get uncompressed size too
ZZIP_STAT zstat;
zzip_dir_stat(mZzipDir, lookUpFileName.c_str(), &zstat, ZZIP_CASEINSENSITIVE);
// Construct & return stream
return DataStreamPtr(OGRE_NEW ZipDataStream(lookUpFileName, zzipFile, static_cast<size_t>(zstat.st_size)));
}
示例15: loadSceneFile
bool GameState::loadSceneFile(Ogre::String filename,NXU::NXU_FileType type)
{
bool success = false;
if (mPhysicsSDK)
{
Ogre::String totalname;
//获得完整文件路径
Ogre::FileInfoListPtr svp = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo("Popular", filename);
totalname = svp->back().archive->getName() + "/" + filename;
Ogre::StringVector sv = Ogre::StringUtil::split(totalname, "/");
totalname = sv[0];
for (unsigned int i = 1;i<sv.size();i++)
totalname += "\\\\" + sv[i];
//读取场景
NXU::NxuPhysicsCollection *c = NXU::loadCollection(totalname.c_str(), type );
if ( c )
{
if (mPhysicScene)
{
mPhysicsSDK->releaseScene(*mPhysicScene);
}
if (mPhysicsSDK)
{
success = NXU::instantiateCollection( c, *mPhysicsSDK, 0, 0, 0);
mPhysicScene = mPhysicsSDK->getScene(0);
}
NXU::releaseCollection(c);
}
else
{
}
}
return success;
}