本文整理汇总了C++中ogre::String::end方法的典型用法代码示例。如果您正苦于以下问题:C++ String::end方法的具体用法?C++ String::end怎么用?C++ String::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::String
的用法示例。
在下文中一共展示了String::end方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onSave
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::onSave(bool forced)
{
Ogre::String dir = mOgitorsRoot->GetProjectOptions()->ProjectDir + "/PGInstances/";
dir = OgitorsUtils::QualifyPath(dir);
mSystem->MakeDirectory(dir);
Ogre::String name = mName->get();
std::replace(name.begin(), name.end(), '<', ' ');
std::replace(name.begin(), name.end(), '>', ' ');
std::replace(name.begin(), name.end(), '#', ' ');
if(!mLastFileName.empty())
mSystem->DeleteFile(mLastFileName);
if(!mTempFileName.empty())
mSystem->DeleteFile(mTempFileName);
Ogre::String filename = OgitorsUtils::QualifyPath(dir + "/" + Ogre::StringConverter::toString(mObjectID->get()) + "_" + name + ".instance");
mLastFileName = filename;
_save(filename);
mTempModified->set(false);
mTempFileName = "";
}
示例2: onSave
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::onSave(bool forced)
{
Ogre::String dir = "/PGInstances/";
OFS::OfsPtr& mFile = mOgitorsRoot->GetProjectFile();
mFile->createDirectory(dir.c_str());
Ogre::String name = mName->get();
std::replace(name.begin(), name.end(), '<', ' ');
std::replace(name.begin(), name.end(), '>', ' ');
std::replace(name.begin(), name.end(), '#', ' ');
if(!mLastFileName.empty())
mFile->deleteFile(mLastFileName.c_str());
if(!mTempFileName.empty())
mFile->deleteFile(mTempFileName.c_str());
Ogre::String filename = dir + Ogre::StringConverter::toString(mObjectID->get()) + "_" + name + ".instance";
mLastFileName = filename;
_save(filename);
mTempModified->set(false);
mTempFileName = "";
}
示例3: 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");
}
}
示例4: loadUrl
//-----------------------------------------------------------------------
void CoherentUIView::loadUrl(const Ogre::String& url)
{
if (mView)
{
std::wstring urlConverted(url.begin(), url.end());
mView->Load(urlConverted.c_str());
}
}
示例5: 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);
}
示例6: exportDotScene
//-----------------------------------------------------------------------------------------
TiXmlElement* CPGInstanceManager::exportDotScene(TiXmlElement *pParent)
{
Ogre::String name = mName->get();
std::replace(name.begin(), name.end(), '<', ' ');
std::replace(name.begin(), name.end(), '>', ' ');
std::replace(name.begin(), name.end(), '#', ' ');
name = Ogre::StringConverter::toString(mObjectID->get()) + "_" + name;
Ogre::String filename = "PGInstances/" + name + ".instance";
TiXmlElement *pNode = pParent->InsertEndChild(TiXmlElement("node"))->ToElement();
// node properties
pNode->SetAttribute("name", mName->get().c_str());
pNode->SetAttribute("id", Ogre::StringConverter::toString(mObjectID->get()).c_str());
// position
TiXmlElement *pPosition = pNode->InsertEndChild(TiXmlElement("position"))->ToElement();
pPosition->SetAttribute("x", "0");
pPosition->SetAttribute("y", "0");
pPosition->SetAttribute("z", "0");
// rotation
TiXmlElement *pRotation = pNode->InsertEndChild(TiXmlElement("rotation"))->ToElement();
pRotation->SetAttribute("qw", "1");
pRotation->SetAttribute("qx", "0");
pRotation->SetAttribute("qy", "0");
pRotation->SetAttribute("qz", "0");
// scale
TiXmlElement *pScale = pNode->InsertEndChild(TiXmlElement("scale"))->ToElement();
pScale->SetAttribute("x", "1");
pScale->SetAttribute("y", "1");
pScale->SetAttribute("z", "1");
TiXmlElement *pPG = pNode->InsertEndChild(TiXmlElement("pagedgeometry"))->ToElement();
pPG->SetAttribute("fileName", filename.c_str());
pPG->SetAttribute("model", mModel->get().c_str());
pPG->SetAttribute("pageSize", Ogre::StringConverter::toString(mPageSize->get()).c_str());
pPG->SetAttribute("batchDistance", Ogre::StringConverter::toString(mBatchDistance->get()).c_str());
pPG->SetAttribute("impostorDistance", Ogre::StringConverter::toString(mImpostorDistance->get()).c_str());
pPG->SetAttribute("bounds", Ogre::StringConverter::toString(mBounds->get()).c_str());
pPG->SetAttribute("castShadows", Ogre::StringConverter::toString(mCastShadows->get()).c_str());
return pPG;
}
示例7: Export
//----------------------------------------------------------------------------------------
int CDotSceneSerializer::Export(bool SaveAs, Ogre::String exportfile)
{
OgitorsRoot *ogRoot = OgitorsRoot::getSingletonPtr();
OgitorsSystem *mSystem = OgitorsSystem::getSingletonPtr();
PROJECTOPTIONS *pOpt = ogRoot->GetProjectOptions();
Ogre::String fileName = pOpt->ProjectName;
UTFStringVector extlist;
extlist.push_back(OTR("DotScene File"));
extlist.push_back("*.scene");
extlist.push_back(OTR("DotScene File"));
extlist.push_back("*.xml");
fileName = mSystem->DisplaySaveDialog(OTR("Export DotScene File"),extlist);
if(fileName == "")
return SCF_CANCEL;
Ogre::String newDir = OgitorsUtils::ExtractFilePath(fileName);
extractOFS(newDir);
mSystem->DeleteFile(newDir + "/" + pOpt->ProjectName + ".ogscene");
TiXmlDocument *pXMLDoc = new TiXmlDocument();
pXMLDoc->InsertEndChild(TiXmlDeclaration("1.0", "UTF-8", ""));
pXMLDoc->InsertEndChild(TiXmlElement("scene"));
// export basic info
TiXmlElement *pRoot = pXMLDoc->RootElement();
pRoot->SetAttribute("formatVersion", "1.0.0");
pRoot->SetAttribute("generator", Ogre::String(Ogre::String("Ogitor SceneBuilder ") + Ogre::String(OGITOR_VERSION)).c_str());
// export resource locations
TiXmlElement *pResourceLocations = pRoot->InsertEndChild(TiXmlElement("resourceLocations"))->ToElement();
for(unsigned int r = 0; r < pOpt->ResourceDirectories.size(); r++)
{
TiXmlElement *pResourceLocation = pResourceLocations->InsertEndChild(TiXmlElement("resourceLocation"))->ToElement();
Ogre::String loc = pOpt->ResourceDirectories[r];
pResourceLocation->SetAttribute("type", "FileSystem");
std::replace(loc.begin(),loc.end(),'\\','/');
if(loc[0] != '.')
loc = "./" + loc;
pResourceLocation->SetAttribute("name", loc.c_str());
}
//TODO: do we need all those object id's ?
TiXmlElement *pEnvironment = pRoot->InsertEndChild(TiXmlElement("environment"))->ToElement();
// export octree scenemanagers
NameObjectPairList smList = ogRoot->GetObjectsByTypeName("OctreeSceneManager");
NameObjectPairList::const_iterator smIt = smList.begin();
while(smIt != smList.end())
{
TiXmlElement *result = smIt->second->exportDotScene(pEnvironment);
saveUserData(smIt->second->getCustomProperties(), result);
smIt++;
}
// export viewports
NameObjectPairList vpList = ogRoot->GetObjectsByTypeName("Viewport Object");
NameObjectPairList::const_iterator vpIt = vpList.begin();
while(vpIt != vpList.end())
{
TiXmlElement *result = vpIt->second->exportDotScene(pEnvironment);
saveUserData(vpIt->second->getCustomProperties(), result);
vpIt++;
}
// export terrains
NameObjectPairList terrainList = ogRoot->GetObjectsByType(ETYPE_TERRAIN_MANAGER);
NameObjectPairList::const_iterator tlIt = terrainList.begin();
while(tlIt != terrainList.end())
{
TiXmlElement *result = tlIt->second->exportDotScene(pRoot);
saveUserData(tlIt->second->getCustomProperties(), result);
tlIt++;
}
NameObjectPairList items = ogRoot->GetSceneManagerEditor()->getChildren();
// export lights
NameObjectPairList::const_iterator nodeIt = items.begin();
while(nodeIt != items.end())
{
if(nodeIt->second->getEditorType() == ETYPE_LIGHT)
{
TiXmlElement *result = nodeIt->second->exportDotScene(pRoot);
saveUserData(nodeIt->second->getCustomProperties(), result);
}
nodeIt++;
}
// export cameras
//.........这里部分代码省略.........
示例8: initialize
/****************************************************************************
**
** Copyright (C) 2016 - 2017
**
** This file is generated by the Magus toolkit
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE go (ODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/
#include "ogre3_renderman.h"
#include "OgreConfigFile.h"
#include "OgreArchiveManager.h"
#include "OgreHlms.h"
#include "OgreHlmsUnlit.h"
#include "OgreHlmsPbs.h"
#include "OgreHlmsManager.h"
#include "OgreHlmsCommon.h"
#include "OgreLogManager.h"
#include "OgreFrameStats.h"
namespace Magus
{
//****************************************************************************/
OgreManager::OgreManager(void)
{
mGlContext = 0;
mCompositorPassProvider = 0;
mPause = true;
#if _DEBUG || DEBUG
mResourcesCfg = "resources_d.cfg";
mPluginsCfg = "plugins_d.cfg";
#else
mResourcesCfg = "resources.cfg";
mPluginsCfg = "plugins.cfg";
#endif
// Create Ogre tt and initialize
mRoot = new Ogre::Root(mPluginsCfg);
// Setup renderer
mCurrentRenderSystem = 0;
const Ogre::RenderSystemList& rsList = mRoot->getAvailableRenderers();
Ogre::RenderSystem* renderSystem = rsList[0];
std::vector<Ogre::String> renderOrder;
#if defined(Q_OS_WIN)
renderOrder.push_back("Direct3D11");
#endif
renderOrder.push_back("OpenGL 3+");
for (std::vector<Ogre::String>::iterator iter = renderOrder.begin(); iter != renderOrder.end(); iter++)
{
for (Ogre::RenderSystemList::const_iterator it = rsList.begin(); it != rsList.end(); it++)
{
if ((*it)->getName().find(*iter) != Ogre::String::npos)
{
renderSystem = *it;
break;
}
}
if (renderSystem != 0) break;
}
if (renderSystem == 0)
{
if (!mRoot->restoreConfig())
{
if (!mRoot->showConfigDialog())
OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS, "Abort render system configuration", "OgreManager::OgreManager");
}
}
renderSystem->setConfigOption("Full Screen", "No");
renderSystem->setConfigOption("VSync", "Yes");
mRoot->setRenderSystem(renderSystem);
mCurrentRenderSystem = renderSystem;
// Uncomment next line to show dialog
//if(mRoot->restoreConfig() || mRoot->showConfigDialog())
//{
mRoot->initialise(false);
//}
// Initialize resources
setupResources();
// Start timer
mTimer = new Ogre::Timer();
mTimer->reset();
//.........这里部分代码省略.........
示例9: _onLoad
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::_onLoad()
{
Ogre::String filename;
if(mTempModified->get())
{
if(mTempFileName.empty())
mTempFileName = OgitorsUtils::QualifyPath(mOgitorsRoot->GetProjectOptions()->ProjectDir + "/Temp/tmp" + Ogre::StringConverter::toString(mObjectID->get()) + ".instance");
filename = mTempFileName;
}
else
{
Ogre::String name = mName->get();
std::replace(name.begin(), name.end(), '<', ' ');
std::replace(name.begin(), name.end(), '>', ' ');
std::replace(name.begin(), name.end(), '#', ' ');
name = Ogre::StringConverter::toString(mObjectID->get()) + "_" + name;
filename = OgitorsUtils::QualifyPath(mOgitorsRoot->GetProjectOptions()->ProjectDir + "/PGInstances/" + name + ".instance");
}
std::ifstream stream(filename.c_str());
if(!stream.is_open())
return;
if(!mTempModified->get())
mLastFileName = filename;
Ogre::StringVector list;
char res[128];
while(!stream.eof())
{
stream.getline(res, 128);
Ogre::String resStr(res);
OgitorsUtils::ParseStringVector(resStr, list);
if(list.size() == 3)
{
PGInstanceInfo info;
info.pos = Ogre::StringConverter::parseVector3(list[0]);
info.scale = Ogre::StringConverter::parseReal(list[1]);
info.yaw = Ogre::StringConverter::parseReal(list[2]);
mInstanceList[mNextInstanceIndex++] = info;
}
else if(list.size() == 4)
{
PGInstanceInfo info;
int index = Ogre::StringConverter::parseInt(list[0]);
info.pos = Ogre::StringConverter::parseVector3(list[1]);
info.scale = Ogre::StringConverter::parseReal(list[2]);
info.yaw = Ogre::StringConverter::parseReal(list[3]);
info.instance = 0;
mInstanceList[index] = info;
if(index >= mNextInstanceIndex)
mNextInstanceIndex = index + 1;
}
}
stream.close();
}
示例10: _onLoad
//-----------------------------------------------------------------------------------------
void CPGInstanceManager::_onLoad()
{
Ogre::String filename;
if(mTempModified->get())
{
if(mTempFileName.empty())
mTempFileName = "/Temp/tmp" + Ogre::StringConverter::toString(mObjectID->get()) + ".instance";
filename = mTempFileName;
}
else
{
Ogre::String name = mName->get();
std::replace(name.begin(), name.end(), '<', ' ');
std::replace(name.begin(), name.end(), '>', ' ');
std::replace(name.begin(), name.end(), '#', ' ');
filename = "/PGInstances/" + Ogre::StringConverter::toString(mObjectID->get()) + "_" + name + ".instance";
}
OFS::OFSHANDLE handle;
OFS::OfsPtr& mFile = mOgitorsRoot->GetProjectFile();
OFS::OfsResult ret = mFile->openFile(handle, filename.c_str());
if(ret != OFS::OFS_OK)
return;
OFS::ofs64 file_size = 0;
mFile->getFileSize(handle, file_size);
if(file_size == 0)
{
mFile->closeFile(handle);
return;
}
char *buffer = new char[(unsigned int)file_size];
mFile->read(handle, buffer, (unsigned int)file_size);
std::stringstream stream;
stream << buffer;
delete [] buffer;
if(!mTempModified->get())
mLastFileName = filename;
Ogre::StringVector list;
char res[128];
while(!stream.eof())
{
stream.getline(res, 128);
Ogre::String resStr(res);
OgitorsUtils::ParseStringVector(resStr, list);
if(list.size() == 3)
{
PGInstanceInfo info;
info.pos = Ogre::StringConverter::parseVector3(list[0]);
info.scale = Ogre::StringConverter::parseReal(list[1]);
info.yaw = Ogre::StringConverter::parseReal(list[2]);
mInstanceList[mNextInstanceIndex++] = info;
}
else if(list.size() == 4)
{
PGInstanceInfo info;
int index = Ogre::StringConverter::parseInt(list[0]);
info.pos = Ogre::StringConverter::parseVector3(list[1]);
info.scale = Ogre::StringConverter::parseReal(list[2]);
info.yaw = Ogre::StringConverter::parseReal(list[3]);
info.instance = 0;
mInstanceList[index] = info;
if(index >= mNextInstanceIndex)
mNextInstanceIndex = index + 1;
}
}
}