本文整理汇总了C++中ogre::String::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ String::empty方法的具体用法?C++ String::empty怎么用?C++ String::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::String
的用法示例。
在下文中一共展示了String::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getConfigPaths
//---------------------------------------------------------------------
void FileSystemLayer::getConfigPaths()
{
// try to determine the application's path:
// recent systems should provide the executable path via the /proc system
Ogre::String appPath = resolveSymlink("/proc/self/exe");
if (appPath.empty())
{
// if /proc/self/exe isn't available, try it via the program's pid
pid_t pid = getpid();
char proc[64];
int retval = snprintf(proc, sizeof(proc), "/proc/%llu/exe", (unsigned long long) pid);
if (retval > 0 && retval < (long)sizeof(proc))
appPath = resolveSymlink(proc);
}
if (!appPath.empty())
{
// we need to strip the executable name from the path
Ogre::String::size_type pos = appPath.rfind('/');
if (pos != Ogre::String::npos)
appPath.erase(pos);
}
else
{
// couldn't find actual executable path, assume current working dir
appPath = ".";
}
// use application path as first config search path
mConfigPaths.push_back(appPath + '/');
// then search inside ../share/OGRE
mConfigPaths.push_back(appPath + "/../share/OGRE/");
// then try system wide /etc
mConfigPaths.push_back("/etc/OGRE/");
}
示例2: QDialog
CreateTerrainDialog::CreateTerrainDialog(QWidget *parent, Ogre::String lastUsedDiffuse, Ogre::String lastUsedNormal) :
QDialog(parent, Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint)
{
setupUi(this);
unsigned int i, index = 1;
Ogitors::PropertyOptionsVector *mapDiffuse = Ogitors::OgitorsRoot::GetTerrainDiffuseTextureNames();
for(i = 0; i < mapDiffuse->size(); i++)
{
if (lastUsedDiffuse == (*mapDiffuse)[i].mKey)
index = i;
mDiffuseCombo->addItem((*mapDiffuse)[i].mKey.c_str());
}
if (lastUsedDiffuse.empty())
index = 1;
if(mapDiffuse->size())
mDiffuseCombo->setCurrentIndex(index);
index = 1;
Ogitors::PropertyOptionsVector *mapNormal = Ogitors::OgitorsRoot::GetTerrainNormalTextureNames();
for(i = 0; i < mapNormal->size(); i++)
{
if (lastUsedNormal == (*mapNormal)[i].mKey)
index = i;
mNormalCombo->addItem((*mapNormal)[i].mKey.c_str());
}
if (lastUsedNormal.empty())
index = 1;
if(mapNormal->size())
mNormalCombo->setCurrentIndex(index);
}
示例3: loadEntity
bool VehicleRenderable::loadEntity(TinyXml::TiXmlElement* ele, Ogre::SceneNode* parent)
{
Ogre::String name = getAttrib(ele, "name");
Ogre::String castShadow = getAttrib(ele, "castShadows");
Ogre::String receiveShadow = getAttrib(ele, "receiveShadows");
Ogre::String meshFile = getAttrib(ele, "meshFile");
Ogre::String materialFile = getAttrib(ele, "materialFile");
try
{
Ogre::Entity* ent = mSceneMgr->createEntity(name, meshFile);
mEntities.push_back(ent);
ent->setCastShadows(Ogre::StringConverter::parseBool(castShadow));
if (!materialFile.empty())
ent->setMaterialName(materialFile);
parent->attachObject(ent);
}
catch (...)
{
Ogre::LogManager::getSingleton().logMessage("VehicleRenderable Error : parsing <" + name + "> error!");
return false;
}
return true;
}
示例4: setupResources
virtual void setupResources(void)
{
GraphicsSystem::setupResources();
Ogre::ConfigFile cf;
cf.load(mResourcePath + "resources2.cfg");
Ogre::String originalDataFolder = cf.getSetting("DoNotUseAsResource", "Hlms", "");
if (originalDataFolder.empty())
originalDataFolder = "./";
else if (*(originalDataFolder.end() - 1) != '/')
originalDataFolder += "/";
const char *c_locations[4] =
{
"2.0/scripts/materials/Tutorial_Terrain",
"2.0/scripts/materials/Tutorial_Terrain/GLSL",
"2.0/scripts/materials/Tutorial_Terrain/HLSL",
"2.0/scripts/materials/Postprocessing/SceneAssets"
};
for (size_t i = 0; i<4; ++i)
{
Ogre::String dataFolder = originalDataFolder + c_locations[i];
addResourceLocation(dataFolder, "FileSystem", "General");
}
}
示例5: setCommandLine
void OgreApp::setCommandLine(const Ogre::String &commandLine)
{
String configFile;
mCommandLine = commandLine;
if(!commandLine.empty())
{
// splits command line in a vector without spliting text between quotes
StringVector quoteSplit = Ogre::StringUtil::split(commandLine, "\"");
// if the first char was a quote, split() ignored it.
if(commandLine[0] == '\"')
quoteSplit.insert(quoteSplit.begin(), " "); // insert a space in the list to reflect the presence of the first quote
// insert a space instead of an empty string because the next split() will ingore the space but not the empty string
// split(" ")->{} / split("")->{""}
for(unsigned int i = 0; i < quoteSplit.size(); i++)
{
if(i&1) // odd elements : between quotes
{
mCommandLineArgs.push_back(quoteSplit[i]);
}
else // even elements : outside quotes
{
StringVector spaceSplit = Ogre::StringUtil::split(quoteSplit[i]);
mCommandLineArgs.insert(mCommandLineArgs.end(), spaceSplit.begin(), spaceSplit.end());
}
}
}
}
示例6: _setMeshFile
//-----------------------------------------------------------------------------------------
bool CEntityEditor::_setMeshFile(OgitorsPropertyBase* property, const Ogre::String& value)
{
if(value.empty())
return false;
bool wasLoaded = mLoaded->get();
bool showBB = mOBBoxRenderable && mOBBoxRenderable->getVisible();
unLoad();
int count = mSubEntityCount->get();
for(int ix = 0; ix < count; ix++)
{
Ogre::String name = "subentity" + Ogre::StringConverter::toString(ix);
mProperties.removeProperty(name + "::material");
mProperties.removeProperty(name + "::visible");
}
mSubEntityCount->set(-1);
if(wasLoaded)
load();
if(showBB)
showBoundingBox(true);
return true;
}
示例7: _parseAnimSound
/** 解析animation sound */
void VEffectManager::_parseAnimSound(Ogre::DataStreamPtr &stream, VSkill *skill)
{
assert(skill != VNULL);
VAnimationSound *sound = skill->addAnimationSound();
assert(sound != VNULL);
Ogre::String line;
while (!stream->eof())
{
line = stream->getLine();
++mParsingLineNumber;
if (!(line.empty() || line.substr(0, 2) == "//"))
{
if (line == "}")
{
break;
}
else
{
_parseAnimSoundAttrib(line, sound);
}
}
}
}
示例8: _parseElement
/** 解析特效元素 */
void VEffectManager::_parseElement(const VString &type, Ogre::DataStreamPtr &stream, VEffect *effect)
{
VEffectElement *element = createElement(type);
assert(element != VNULL);
effect->addElement(element);
Ogre::String line;
while (!stream->eof())
{
line = stream->getLine();
++mParsingLineNumber;
if (!(line.empty() || line.substr(0, 2) == "//"))
{
// 跳过空行和注释行
if (line == "}")
{
break;
}
else
{
_parseElementAttrib(line, element);
}
}
}
}
示例9:
//-----------------------------------------------------------------------
static Ogre::String concatenate_path(const Ogre::String& base, const Ogre::String& name)
{
if (base.empty() || is_absolute_path(name.c_str()))
return name;
else
return base + '/' + name;
}
示例10: LOG
void RoR::SkidmarkConfig::LoadDefaultSkidmarkDefs()
{
LOG("[RoR] Loading skidmarks.cfg...");
Ogre::String group = "";
try
{
group = Ogre::ResourceGroupManager::getSingleton().findGroupContainingResource("skidmarks.cfg");
if (group.empty())
{
LOG("[RoR] Failed to load skidmarks.cfg (file not found)");
return;
}
Ogre::DataStreamPtr ds = Ogre::ResourceGroupManager::getSingleton().openResource("skidmarks.cfg", group);
Ogre::String line = "";
Ogre::String currentModel = "";
while (!ds->eof())
{
line = RoR::Utils::SanitizeUtf8String(ds->getLine());
Ogre::StringUtil::trim(line);
if (line.empty() || line[0] == ';')
continue;
Ogre::StringVector args = Ogre::StringUtil::split(line, ",");
if (args.size() == 1)
{
currentModel = line;
continue;
}
// process the line if we got a model
if (!currentModel.empty())
this->ProcessSkidmarkConfLine(args, currentModel);
}
}
catch (...)
{
LOG("[RoR] Error loading skidmarks.cfg (unknown error)");
m_models.clear(); // Delete anything we might have loaded
return;
}
LOG("[RoR] skidmarks.cfg loaded OK");
}
示例11: registerHlms
virtual void registerHlms(void)
{
GraphicsSystem::registerHlms();
Ogre::ConfigFile cf;
cf.load(mResourcePath + "resources2.cfg");
Ogre::String dataFolder = cf.getSetting("DoNotUseAsResource", "Hlms", "");
if (dataFolder.empty())
dataFolder = "./";
else if (*(dataFolder.end() - 1) != '/')
dataFolder += "/";
Ogre::RenderSystem *renderSystem = mpRoot->getRenderSystem();
Ogre::String shaderSyntax = "GLSL";
if (renderSystem->getName() == "Direct3D11 Rendering Subsystem")
shaderSyntax = "HLSL";
Ogre::Archive *archiveLibrary = Ogre::ArchiveManager::getSingletonPtr()->load(
dataFolder + "Hlms/Common/" + shaderSyntax,
"FileSystem", true);
Ogre::Archive *archiveLibraryAny = Ogre::ArchiveManager::getSingletonPtr()->load(
dataFolder + "Hlms/Common/Any",
"FileSystem", true);
Ogre::Archive *archivePbsLibraryAny = Ogre::ArchiveManager::getSingletonPtr()->load(
dataFolder + "Hlms/Pbs/Any",
"FileSystem", true);
Ogre::Archive *pbsLibrary = Ogre::ArchiveManager::getSingletonPtr()->load(
dataFolder + "Hlms/Pbs/" + shaderSyntax,
"FileSystem", true);
Ogre::ArchiveVec library;
library.push_back(archiveLibrary);
library.push_back(archiveLibraryAny);
library.push_back(archivePbsLibraryAny);
library.push_back(pbsLibrary);
Ogre::Archive *archiveTerra = Ogre::ArchiveManager::getSingletonPtr()->load(
dataFolder + "Hlms/Terra/" + shaderSyntax,
"FileSystem", true);
Ogre::HlmsTerra *hlmsTerra = OGRE_NEW Ogre::HlmsTerra(archiveTerra, &library);
Ogre::HlmsManager *hlmsManager = mpRoot->getHlmsManager();
hlmsManager->registerHlms(hlmsTerra);
//Add Terra's piece files that customize the PBS implementation.
//These pieces are coded so that they will be activated when
//we set the HlmsPbsTerraShadows listener and there's an active Terra
//(see Tutorial_TerrainGameState::createScene01)
Ogre::Hlms *hlmsPbs = hlmsManager->getHlms(Ogre::HLMS_PBS);
Ogre::Archive *archivePbs = hlmsPbs->getDataFolder();
Ogre::ArchiveVec libraryPbs = hlmsPbs->getPiecesLibraryAsArchiveVec();
libraryPbs.push_back(Ogre::ArchiveManager::getSingletonPtr()->load(
dataFolder + "Hlms/Terra/" + shaderSyntax + "/PbsTerraShadows",
"FileSystem", true));
hlmsPbs->reloadFrom(archivePbs, &libraryPbs);
}
示例12: getConfigPaths
void FileSystemLayer::getConfigPaths()
{
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
// try to determine the application's path
DWORD bufsize = 256;
char* resolved = 0;
do
{
char* buf = OGRE_ALLOC_T(char, bufsize, Ogre::MEMCATEGORY_GENERAL);
DWORD retval = GetModuleFileName(NULL, buf, bufsize);
if (retval == 0)
{
// failed
OGRE_FREE(buf, Ogre::MEMCATEGORY_GENERAL);
break;
}
if (retval < bufsize)
{
// operation was successful.
resolved = buf;
}
else
{
// buffer was too small, grow buffer and try again
OGRE_FREE(buf, Ogre::MEMCATEGORY_GENERAL);
bufsize <<= 1;
}
} while (!resolved);
Ogre::String appPath = resolved;
if (resolved)
OGRE_FREE(resolved, Ogre::MEMCATEGORY_GENERAL);
if (!appPath.empty())
{
// need to strip the application filename from the path
Ogre::String::size_type pos = appPath.rfind('\\');
if (pos != Ogre::String::npos)
appPath.erase(pos);
}
else
{
// fall back to current working dir
appPath = ".";
}
#elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
Ogre::String appPath;
if(!widePathToOgreString(appPath, Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data()))
{
// fallback to current working dir
appPath = ".";
}
#endif
// use application path as config search path
mConfigPaths.push_back(appPath + '\\');
}
示例13: setMaterialName
void MeshObject::setMaterialName(Ogre::String m)
{
if(m.empty()) return;
materialName = m;
if(loaded && ent)
{
ent->setMaterialName(materialName);
}
}
示例14: addPage
//-----------------------------------------------------------------------------------------
bool CTerrainGroupEditor::addPage(const int x, const int y, const Ogre::String diffuse, const Ogre::String normal)
{
if (diffuse.empty() || normal.empty())
return false;
OgitorsPropertyValueMap creationparams;
OgitorsPropertyValue pvalue;
Ogre::String pagename = mPageNamePrefix->get();
pagename += Ogre::StringConverter::toString(x);
pagename += "x";
pagename += Ogre::StringConverter::toString(y);
creationparams["init"] = EMPTY_PROPERTY_VALUE;
pvalue.propType = PROP_STRING;
pvalue.val = Ogre::Any(pagename);
creationparams["name"] = pvalue;
Ogre::Vector3 position;
mHandle->convertTerrainSlotToWorldPosition(x, y, &position);
pvalue.propType = PROP_VECTOR3;
pvalue.val = Ogre::Any(position);
creationparams["position"] = pvalue;
pvalue.propType = PROP_INT;
pvalue.val = Ogre::Any(x);
creationparams["pagex"] = pvalue;
pvalue.propType = PROP_INT;
pvalue.val = Ogre::Any(y);
creationparams["pagey"] = pvalue;
pvalue.propType = PROP_STRING;
pvalue.val = Ogre::Any(diffuse);
creationparams["layer0::diffusespecular"] = pvalue;
pvalue.propType = PROP_STRING;
pvalue.val = Ogre::Any(normal);
creationparams["layer0::normalheight"] = pvalue;
pvalue.propType = PROP_REAL;
pvalue.val = Ogre::Any((Ogre::Real)10.0f);
creationparams["layer0::worldsize"] = pvalue;
CTerrainPageEditor* page = (CTerrainPageEditor*)mOgitorsRoot->CreateEditorObject(this, "Terrain Page", creationparams, true, true);
return true;
}
示例15:
bool
findCorrelativeResource(String& resourceName,Ogre::String& groupName,
const Ogre::String& baseResourceName, const Ogre::String& baseGroupName)
{
Ogre::ResourceGroupManager& mgr = Ogre::ResourceGroupManager::getSingleton();
Ogre::String name, path;
Ogre::StringUtil::splitFilename(resourceName, name, path);
bool existsPath = !path.empty();
String grp = baseGroupName;
// First, find in correlatived group and path if resource name doesn't exists path
if (!existsPath)
{
Ogre::StringUtil::splitFilename(baseResourceName, name, path);
if (!path.empty())
{
name = path + resourceName;
if (mgr.resourceExists(grp, name))
{
resourceName = name;
groupName = baseGroupName;
return true;
}
}
}
// Second, find in correlatived group
if (mgr.resourceExists(grp, resourceName))
{
groupName = baseGroupName;
return true;
}
// Three, find in user given group
if (!groupName.empty())
{
if (mgr.resourceExists(groupName, resourceName))
{
return true;
}
}
// Four, find in global default group
if (groupName != DEFAULT_RESOURCE_GROUP_NAME)
{
Ogre::String grp = DEFAULT_RESOURCE_GROUP_NAME;
if (mgr.resourceExists(grp, resourceName))
{
groupName = grp;
return true;
}
}
return false;
}